It didn’t work because your tax query is missing the operator which should be set to NOT IN
. So just add it like so:
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-' . $post_format ),
'operator' => 'NOT IN',
)
),
And please, avoid using query_posts()
— use new WP_Query()
or get_posts()
instead — or hooks such as pre_get_posts
for modifying the query parameters.
Related Posts:
- Does WordPress generate an automatic page for post formats?
- How to query posts of standard post format. For real
- Query different number of posts with different formats in one go
- How to query for posts without a post_format
- How to exclude post formats from wordpress recent posts in a tabs widget [closed]
- Query only the posts with a post format of “audio”
- Post archive for certain post format
- How to create Page templates for showing Blog posts in different layouts?
- Query posts in current category but not attachment format
- An archive page without post format (just standard post)
- Exclude post formats in custom loop
- How to query posts from single post format on Genesis framework
- Display post format post in the sidebar
- meta_query with meta values as serialize arrays
- WordPress tax_query “and” operator not functioning as desired
- How to paginate wordpress [gallery] shortcode?
- get_template_part in for loop
- How to display post from current Taxonomy in archive page?
- Getting attachments by meta value
- Display recent posts from the same category as current post in sidebar
- WP_Query pulling an extra post per page
- Using is_main_query to select custom post type on certain page
- WP_Query ordered by custom field that is a date string?
- WP_Query with LIKE in meta gives strange query
- WP_Query not working as expected for attachments and custom meta_query
- How to Get All Posts but the Private ones?
- querying on custom meta fields and sorting them by custom meta
- WP Query by Gutenberg block and get its attribute
- Custom URl parameter
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- order by multiple meta keys in pre_get_posts
- Order By Multiple Meta Fields
- WP_Query Performance Issues with meta_query
- Advanced WP Query hogs the SQL server
- WP_QUERY loop, offset in the arguments and the paginate_links – can these work together?
- How to combine meta_query and post__in in WP_Query
- Is it faster to query records using $wpdb instead of Wp_Query?
- Display posts if specific country
- query user display_name failed in a custom mysql query foreach
- Meta box dropdown of custom posts
- Date and Category query with filter
- Query: offset post list, unless it’s a specific category
- Get posts for which a custom field is not present, with get_posts
- Output an array of terms for a ‘tax_query’ => array()
- querying data via $wpdb and get_row
- Combining categories (Query posts with multiple taxonomy terms)
- Filtering out child category posts from parent category archive not working
- wp_update_post not working
- WP_Query with offset and ‘orderby’ => ‘rand’, offset not working
- WP_Query Limit Data_Query last 90 days
- Sort WordPress Posts Meta value by Week not Day
- WP_Query arguments order
- Best choice for multiple loop in page?
- How to order WP_Query to group results?
- new WP_Query messes up pagination
- How to create custom query by keyword in post title?
- get term id from term name
- Get Child Category only
- Order is breaking wp_query
- Issues with search after added meta_query
- How to load a script code only in posts?
- Woocommerce: order posts by meta key
- Modify query posts
- Multiple meta query from array
- Find only those galleries with images
- WQ Query post meta date comparison
- Category not being selected
- WP_Query with 4 post meta field arguments gives 500 internal server error
- Filter subpages in while loop from WP Query object
- How to filter a static post page with ajax and $wp_query
- WP Query Order By Multiple Values
- Error: Attempt to read property “ID” on null
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Unrelated post showing in WP_Query
- Custom meta_query order for Elementor based on post meta key [closed]
- wordpress pagination wont render on custom page template even though its right under the loop like the documentation says so
- How to combine meta_query and date_query with condition in WordPress
- ElasticPress is (aparently) messing with my search filters
- get_posts function not returning any results
- INNER JOIN custom tables – SQL Query
- How to query search only for post titles?
- Shortcode attributes causes 500 error after updating the page
- WP Query. Ordering posts by another post types meta
- How to display author meta and count numbers for each user in comment.php?
- update_post_meta() not updating
- WP_Query to Retrieve Posts from WooCommerce Products that are Only in Catalog
- Get top 5 posts viewed using post_views_count
- query_posts based on a meta_key
- Track write actions to the database
- Query with two posttypes and two different meta_keys
- Sort by meta key within same day
- Duplicates When using Nested WP_Query
- meta_query not working with the_content()
- Show portfolio items in template – how?
- Display post list within category list sorted by name [duplicate]
- Problem with WordPress 4.0 and $wp_query
- Add category and user name to recently updated post list
- How to return value from sql and display it
- How to account for empty key values in wp_query?
- Get comment number by date range?