I believe what you are looking for is the relation
parameter in meta_query
. I’m assuming you are using the WP_Query
class to make the call given your syntax in the example. You might want to ensure that no other plugins are forcing the relation parameter to be “OR” instead of the default “AND” by hooking into pre_get_posts
.
$meta_query_AND = array(
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'featured',
'value' => 'yes',
'compare' => 'NOT NULL',
),
array(
'key' => 'type',
'value' => 'event',
'compare' => 'NOT NULL',
)
)
);
$test_query = new WP_Query( $meta_query_AND );
The first step would be to evaluate the meta_query
=> relation
value in your wp_query
result.
Related Posts:
- Sort Order for a Custom Query in a Post Type Archive Not Working
- WordPress Admin Panel search posts with custom post meta values along with title
- query posts and custom post type with meta key
- Add meta value to custom post type on publish
- Permalink structure by Post Meta value
- How do I create an archive page as a including metadata?
- How do I set default meta value by post type?
- Sort column on meta key and meta value
- updating one custom meta field only
- Orderby meta_key/meta_value not displaying anything, am I overlooking anything?
- Query to show post current day
- How to use multiple Meta Field from CPT as Post permalink
- Query posts by current ACF meta key value on single page as related posts
- Using Orderby and meta_value to order natural/alphanumerical
- Filter between Custom Posts depending on meta_value
- Display a list of posts whose meta field values are equal to the ID of the post being viewed?
- Check for custom field value in different post type than current one and do something
- How to get custom post type post id from slug?
- How to make a WP_Query search with custom post types?
- How to show Y number of custom posts after every X normal posts?
- Custom post types vs post formats : future-proofing – is one less “future proof” than another?
- create a mostly read only CPT
- Hide/Show only specific categories in wp-admin new-post.php
- Front end registration/login & publish/update 1 custom post
- Taxonomy page returns 404 page not found
- Password-protect a custom rss feed
- Refine custom posts by author
- Post type archive page not working
- WordPress query by multiple Custom fields and order by date
- Unable to filter on field on edit.php page
- Help with hierarchical custom taxonomies and permalinks…almost there
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to get only one category of custom post type?
- Adding posts of custom type into the main feed
- Create separate template for shared custom taxonomy with shared terms
- Correct way to use get_template_part() and get_post_format() with custom post types?
- Changing the header on post listing page in admin area
- Get random custom posts from a custom post type
- Return Attachments from Custom Post Type
- Display custom post type taxonomy and month
- How to search for many post types?
- Pull Two Different Post Types into Different HTML Containers on the Same Page
- Why my CPT does not appear on the dashboard menu when i activate the plugin?
- “add_post_type_support” with Custom Post Type & ACF
- Problem fields custom date, time, and checkbox
- Notice: Undefined index: suppress_filters
- My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
- List of Posts in a Custom Field
- Custom Post Type Nav to Subpage
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- 2 Templates 1 custom post type according url
- URLs for child terms
- changing meta value and meta key of price field
- Trash / Draft a WordPress custom post after custom date field expires
- Custom Meta Field – Remove comma from string with str_replace
- Query taxonomy of taxonomy of custom post type
- Category with post type pagination returns 404
- WPMU: Cross site custom post type
- Cannot Create new Post within Custom Post Type
- custom post type and non-standard gallery
- Is it possible to activate customfield ‘text description’ upon activating the customfield ‘checkbox’?
- Issue on Working with Metabox – Checkbox to enable Sale Items
- How do I amend form data before it is saved for a custom post type
- Custom Permalinks for Custom Post Types
- Route subpage to Custom Post Type
- How to display custom taxonomy term meta on custom post type
- Revert to previous dropdown options after change
- wp-includes does not contain a feed template
- Implement location at wordpress post via custom taxonomies?
- Show specific content on parent custom post type and all children
- Ajax Post Filter | Split Taxonomy Into minPrice & maxPrice
- URL issue retrieving Custom Post Types using Backbone JS API
- How can I add a URL link to my post type?
- WordPress Page hierarchy ( parent is singular of custom post types slug ) is returning not found
- Foreach result into WP_query
- Accessing download link from the loop with WP Download Manager Pro
- How to sort post category using its Description
- Add class attribute in Custom Post Type
- Custom WordPress theme not displaying posts from category
- Wanting to list all Post types under a common category
- Prev / Next Post Same taxonomy Custom Post Type
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- update flamingo_inbound post type after insert
- wp_insert_post() creates duplicates with ‘post_status’ => ‘publish’
- Can I rename the description field in a custom post type?
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Custom user roles
- WordPress feed only shows first page of category
- Search attachments in custom post type only
- Same permalink structure for all post types?
- Custom Info Box at end of posts?
- Pages displays correctly but returning a 404 error in http header.
- Modifying and Displaying URL’s in a Post Template using parse_url
- Query by post type or category
- Categories and page filtering with pre_get_posts
- Register_post and add_menu & add_submenu conflict?
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- Allow child pages with the same base as the CPT slug
- upload image with rest API to the media library
- WordPress post objects in one parent post object