Home › Forums › Support › Limit number of words in posts when query specific tag/category This topic has 3 replies, 2 voices, and was last updated 3 years, 2 months ago by David. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts February 13, 2021 at 11:38 pm #1657498 Joyce Hi Team, I’d like to restrict number of words in post when I see the post list for specific tag/category e.g. http://www.abc.com/tag/tag1, http://www.abc.com/category/catatory1 thanks, Joyce February 14, 2021 at 7:51 am #1657936 DavidStaff Customer Support Hi there, you can use a filter like this: add_filter( 'excerpt_length', function( $length ) { $categories = array( 'cat-one', 'cat-two', 'cat-three', ); $tags = array( 'tag-one', 'tag-two', 'tag-three', ); if ( is_category( $categories ) || is_tag( $tags ) ) { $length = 25; } return $length; }, 200 ); February 16, 2021 at 4:57 pm #1661069 Joyce thanks David February 17, 2021 at 3:29 am #1661475 DavidStaff Customer Support You’re welcome Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In