В файл functions.php активной темы добавьте код:
function remove_post_from_subcat( $where ){
global $wp_query, $wpdb, $wp_version;
// Fire off if we're viewing a category archive
if ( is_category() ){
// Get children categories of current cat if they exist
if ( $excludes = get_categories( "child_of=" . $wp_query->get( 'cat' ) ) ) {
// For each child, add just the ID to an array
foreach ( $excludes as $key => $value ) {
$exs[] = $value->term_taxonomy_id;
}
}
// If array exists, remove posts in child categories from query.
if ( isset( $exs ) && is_array( $exs ) ) {
// WP Query changed in 3.1
if ( version_compare( $wp_version, 3.1, '<' ) )
$where .= " AND " . $wpdb->prefix . "term_taxonomy.term_id NOT IN ( ". implode( ",", $exs ) . " ) ";
else
$where .= " AND " . $wpdb->prefix . "term_relationships.term_taxonomy_id NOT IN ( ". implode( ",", $exs ) . " ) ";
}
}
return $where;
}
add_filter( 'posts_where', 'remove_post_from_subcat' );
после написания данного кода, при переходе в рубрику, там надпись нечего не найдено и пустота (