Filtering "latest posts" option for home page?

Have site set up to display “latest posts,” as site is a blog. Now want to find way to only display latest posts of specific category, not ANY post. Is there way to do that? Or to change how the home page is configured to enable? Thank you for help!

Hello there,

Try adding this code snippet to your child theme’s functions. Or use a plugin that does the same purpose like Code Snippets.

    function sydney_pro_child_filter_category_post( $query ) {
        if ( $query->is_home() && $query->is_main_query() && ! is_admin() ) {

          $taxquery = array(
                'taxonomy' => 'category',
                'field'    => 'slug',
                'terms'    => array('uncategorized'),
                'operator' => 'IN'

          $query->set( 'tax_query', $taxquery );

    add_action( 'pre_get_posts', 'sydney_pro_child_filter_category_post' );

Replace uncategorized above with your post’s category slug name.


That worked perfectly. Thank you so much for the solution and the quick response!

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.