you need to add a LIKE in your meta_query
$args = array(
'post_type'=> 'recipe',
'meta_query' => array(
array(
'key' => 'special_diets',
'value' => 'vegan',
'compare' => 'LIKE',
)
),
);
$query = new WP_Query($args);
as explained here Count custom post types with a specific meta value
Related Posts:
- Filtering a WP_Query meta_query by numeric values isn’t working
- Meta Query “IN” doesn’t work with ACF checkbox filter
- List events by month
- exclude custom post type by meta key in wp_query
- Remove duplicated values from a loop
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Stuck in Order by more then one
- Meta Query Not Returning Output Despite Having Matching Values
- The loop seems stuck to a single (now deleted) post
- Query based on custom fields start and end date
- Custom post type showing same Post on all Pages
- Post loop count is not in order
- get custom post type value in header.php [closed]
- WordPress giving a 404 page when passing a year argument different than the current year
- Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis
- Using WP meta query to show custom post types by a start and finish date
- Fetch data from two custom post types and create multidimensional array for output to html table
- Filter result of Custom Post Type using meta_query with ACF
- Query posts by current ACF meta key value on single page as related posts
- Show custom post type event if current day using ACF
- Some posts not displaying by taxonomy term
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Sort loop by custom field from different post type
- Display related post content and custom field content
- $post breaking container loop
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- loop through custom post-type with two meta_keys
- Filter page ID outside the loop and order
- WordPress post objects in one parent post object
- Meta query with ACF relationship field
- How can I filter records in a custom post type list in the admin based on the ACF field in the post that contains the current user?
- CPT archive admin menu label
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Using meta_query and tax_query at the same time
- WP Query with categories only shows one post and ignores the category
- What to and how to proceed with CPT to make DB small and efficient?
- Order Custom Post Type by Custom Field Value
- Post ID randomly printing on page
- A custom post within a custom post
- Display Custom Taxonomy Alphabetically
- Full Custom Post Type List Organised by two Taxonomies
- Displaying Custom Posts on a Page
- Retrieve custom field from Contact Form 7 [closed]
- Shortcode not working with post counter
- Problem: wp_query outputs all images on site
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- How to query WordPress posts bycustom field with a max characters’ length
- search suggest – filter post type
- Get custom post type’s fields in a while loop as variables
- Custom Post Type within the Loop on Homepage (Page Template)
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Meta Query posts not showing on ending date of custom field
- Posts per row on archive page (custom post type)
- How do I know the ‘meta_key’ for ordering my custom post type
- How to update post meta on uploaded image from a custom form?
- How to group posts and get a mixed posts and groups view?
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- Custom Theme With Custom Loops
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Custom Post Types strange pagination problem
- Ordering custom post type by multiple custom fields
- How to Output which matched meta_keys were found from custom_type_posts?
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- Multiple Frontend Filters Using Advanced Custom Fields
- Integrate Custom Post Type Events into Calendar
- Possible to filter custom post type with multiple meta data?
- Specific routing for CPT
- Order post by date with ACF
- Custom post type conditional in loop
- Displaying custom field according to date
- Listing all term items alphabetically / sorting loop
- Display related custom taxonomy posts in sidebar
- filter search custom field query
- How to let users choose where to search for posts?
- How to set the seo title tag on a page by page basis?
- WebP Fallback for Inline Background Image in Style Attribute
- pagination not working for category.php (custom post types in categories)
- Adavnced custom fields relationship query plus query inside
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- How do I control the output of a custom post type in the loop?
- Display custom post type posts first, then default posts
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Three Most Recent Posts, One Per Term
- Targeting custom post type
- Does WP have a global of $id?
- How To Import CPT With Only Few TEXT ACF Fields From Front End?
- WordPress Loop if/else
- get_the_title() is returning results from previous loop
- Advanced custom field boolean value in custom post type
- Custom Post Loop pulling all custom posts, not just one
- Conditional for a Single Post That Belongs to a Category?
- Wrapping x posts in html without leaving empty html
- WP Query post__in not returning correct results
- Custom Post Type single.php template only shows the latest post
- Why is my WP Query not returning first result’s post meta?
- Sort posts in loop by the WooCommerce Membership of the author