retrieve_sticky_posts() not correctly checking post__not_in
-
Your code for retrieve_sticky_posts() includes the following:
// If any posts have been excluded specifically, Ignore those that are sticky. if ( !empty($sticky_posts) && !empty($q['post__not_in']) ) { $sticky_posts = array_diff($sticky_posts, $q['post__not_in']); }
However, the code in the functio never defines $q, but since you’re checking the whole thing with empty() it doesn’t crop up as an error. This casues explicitly excluded sticky posts to still show up.
It should be this:
// If any posts have been excluded specifically, Ignore those that are sticky. if ( !empty($sticky_posts) && !empty($wp_query->query_vars['post__not_in']) ) { $sticky_posts = array_diff($sticky_posts, $wp_query->query_vars['post__not_in']); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘retrieve_sticky_posts() not correctly checking post__not_in’ is closed to new replies.