Show only single category posts on WordPress archive page
Here is the code you can use to show only single category posts on wordpress archive page. function my_custom_get_posts( $query ) { if ( $query->is_archive() ) { $blog_term = get_term_by(‘slug’, ‘your-blogcategry-slug-name’, ‘category’); $blog_term_id = $blog_term->term_id; $query->set(‘cat’, $blog_term_id); } } add_action( ‘pre_get_posts’, ‘my_custom_get_posts’, 1 );