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
- WP_Query orderby custom field then post_date in one query
- Filter a custom field based on selection of another custom field (ACF) [closed]
- filter search result with custom post type meta key
- Posts in Multiple Columns and Rows with one single loop
- Alphabetical sorting of custom post type – one letter per page
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- How to display the rest of categories on Portfolio filterable
- Get_post_meta() won’t return value
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- get_template_part for custom post type content not working
- Ignore sticky posts if post is not in meta query
- Creating Accordians in WordPress Theme
- Display different content on homepage depending on post type
- Rewrite WordPress URL to show CPT meta field data
- Sorting Custom Post Type by Meta Value but wont display when set to 0
- WP_Query orderby modified to include custom meta changes
- get_attached_media() on author page not working
- Get posts between custom dates
- Custom post type multiple loop by taxonomy term
- List custom taxonomy specific to one custom post type
- Custom post type, organized by categories
- WP Meta query for a custom post type based on two values
- What’s the WP way to load remaining custom posts?
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- How can I group posts by months and years?
- set_query_params using custom params defined in functions file?
- How to define the template for custom posts?
- How to export custom post type with ACF to individual file with automation?
- Display post from custom post type
- Query Posts, order by meta value
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Custom field with Types: get custom field’s value label (of type select)
- Drop down list with posts within the “add new” page
- How to show custom post type on homepage and in categories
- using the loop in custom meta is messing up ‘add new’ post type
- How can I loop at a Specific Taxonomy from a custom post type?
- Update query based on CPT / Post Type, show all sorted by date
- Create if else for post types in WP_Query ‘post__in’ values
- CPT email notification including only new value custom fields
- How to avoid duplicate posts queried from custom meta?
- Orderby if between two meta fields
- Why do my custom post type show up in all pages?
- search results to show individual ACF fields from inside custom posts
- Videos Post Type with Custom Filters
- Staggering featured post using ‘sticky’
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Show parent category and subcategory once in while loop
- Use output of wp_dropdown_categories($args)
- How to build Custom Post Nav Menu inside of the Loop
- Meta_query by date for Events archive
- next_posts_link() always generates second page link on custom post type
- Values show up in custom home page but not in custom post pages
- Show posts for current taxonomy
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Multiple loops for custom post type to spread data across rows
- Loop multiple taxonomy in custom post
- Posts without featured image using other post’s featured image
- Nested loop called with shortcode duplicating the content above the main loop
- Querying meta values within an array
- why get_post_meta is returning 0?
- Show search for data extracted from metabox
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Retrieve a post with its ACF repeater fields in wordpress
- How can I show posts with the same tag?
- Custom taxonomy meta fields
- Custom Sort Order for Custom Post Type Taxonomy