your code looks compliant with the code in this post http://wordpress.mfields.org/2011/post-format-queries/
how does the WP_Query() code fit into the code of the page template?
btw: the exclusion seems to work in a page template in my local test setup runing Twenty Twelve; my example code:
<?php $formats = new WP_Query( array(
'posts_per_page' => 20,
'paged' => get_query_var('paged'),
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-link', 'post-format-aside', 'post-format-gallery' ),
'operator' => 'NOT IN',
)
)
));
if( $formats->have_posts() ) : while( $formats->have_posts() ) : $formats->the_post();
echo '<h4>'; the_title(); echo '</h4>';
endwhile; endif; wp_reset_postdata(); ?>
could there be a possible interference from a plugin?
Thread Starter
zeaks
(@zeaks)
I don’t have any plugins installed but wp-pagenavi which I’ve removed, and it’s a new wp install.
I tried this using your example as a test template and it limits the posts but won’t filter the formats. The first two posts it displays are an aside and gallery format.
<?php get_header(); ?>
<?php $formats = new WP_Query( array(
'posts_per_page' => 4,
'paged' => get_query_var('paged'),
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-link', 'post-format-aside', 'post-format-gallery' ),
'operator' => 'NOT IN',
)
)
));
if( $formats->have_posts() ) : while( $formats->have_posts() ) : $formats->the_post();
echo '<h4>'; the_title(); echo '</h4>';
endwhile; endif; wp_reset_postdata(); ?>
<?php get_sidebar( 'front' ); ?>
<?php get_footer(); ?>
Thread Starter
zeaks
(@zeaks)
Wow nevermind, I think I’ve been staring at this for too long, it does work.
I had been playing around with the posts formats and had them all set as links and quotes, everything but what I had excluded.
Thanks for the help