We use a featured tabber in our Headlines theme, which shows posts that you have tagged with a pre-defined tag(s) (you define it in options panel).
We then exclude these tagged posts from the normal posts beneath the featured tabber with this query:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post__not_in' => $GLOBALS['shownposts'], 'cat' => '-'.$GLOBALS[video_id], 'paged'=> $paged ); query_posts($args); ?>
This works great for the first page, but when you view previous posts (page 2), it does not exclude the posts that were excluded on page 1.
I tried to exclude the tag directly with this code:
<?php global $wpdb; $tag = $wpdb->get_var("SELECT term_ID FROM $wpdb->terms WHERE name='featured'"); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'tag__not_in' => array($tag,), 'cat' => '-'.$GLOBALS[video_id], 'paged'=> $paged ); query_posts($args); ?>
This does work, and it also works on page 2 and onwards.
It seems to me that the
post__not_indoes not work with paged pages. Does anybody know if this is a bug, or how I can report the bug?
- The topic ‘Possible WP bug: Excluding post id’s with paged query’ is closed to new replies.