Excluding post categories, even for sticky posts
-
I’m passing some arguments to wp_query() that select all posts except for those in a category named “slider.” In other words, I want to exclude posts in the “slider” category, like so:
$args = array ( 'posts_per_page' => get_option( 'posts_per_page' ), 'paged' => max( 1, get_query_var( 'paged' )), 'cat' => '-112', // slider category ); $wp_query = new WP_Query( $args );Here’s the strange thing / unexpected behavior: if a post is in the “slider” category, but it’s marked as sticky, it is *not* excluded from the list of selected posts. Is this correct? Or am I doing something wrong? How can I filter out posts in a category, even if they’re sticky?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Excluding post categories, even for sticky posts’ is closed to new replies.