Basically, when I view the All Posts page in Wordpress Admin, I want to filter out all posts (exclude them) from a specific category to not be shown there.
After some searching, I found this hook, it works but it works in all admin
function exclude_category_posts( $query ) {
if ( $query->is_main_query() && is_admin()) {
$query->set( 'cat', '-13' );
}
}
add_filter( 'pre_get_posts', 'exclude_category_posts' );
I've created another menu in WP Admin that shows only posts from that excluded category but when I apply this function, it shows nothing there too. Not sure if this is possible but I thought I ask some of you kind folk here.