I’m guessing you haven’t exposed meta_key and meta_value to the REST API with the rest_query_vars filter, so this should do it:
function my_add_meta_vars ($current_vars) {
$current_vars = array_merge ($current_vars, array ('meta_key', 'meta_value'));
return $current_vars;
}
add_filter ('rest_query_vars', 'my_add_meta_vars');
Then you can refer to meta_key and meta_value in your query.
Be aware that this obviously exposes all your post metadata to the API, which has potential security implications; I believe that’s why it’s not activated by default.
Related Posts:
- Filtering multiple custom fields with WP REST API 2
- sort by date in Advanced Custom Field
- Display post in order of ACF checkbox?
- Multiple orderby date arguments
- Check for the existence of custom field
- pre_get_posts filter using numeric meta_query comparison (from dates)
- Using meta_query and custom fields within pre_get_posts to return posts within a numerical range
- Comparing arrays with meta_query in pre_get_posts
- Order WP Query posts by custom order calculated from post meta values
- ACF repeater field with meta_query
- Get specific repeater row (via advanced custom fields) based on Meta Query with Wildcards [closed]
- Using pre_get_posts for meta value of LIKE comparison on ACF repeater sub field
- WP Rest endpoint with custom post type and ACF Fields
- Organize media library into folders and get folders via WP Rest API?
- How to get custom fields in a post when published
- Filter posts by advanced custom field
- Get posts with multiple meta values
- Order get_terms by multiple meta_values
- How can you query posts by advance custom field when the value is a serialized array? [closed]
- Query by radio button ACF
- WP get_posts meta_query using ACF repeater field
- Fill up advanced custom field of a custom post type via API REST POST
- get_posts filter meta_query using ACF Checkbox
- Display posts every specific day
- How to use germ_terms() with meta_query for ACF Taxonomy field?
- ACF order relationship by date
- Pin to Top Functionality using orderby custom field then event date
- Array sorting by custom field date
- Time sort with meta_key using UNIX timestamp failing due to date differences
- ACF orderby not sorting dates correctly [closed]
- WordPress API V2 – filter and order by ACF field
- How to do a meta query using REST-API in WordPress 4.7+?
- How to import CSV into Custom Post Type custom fields?
- Advanced Custom Fields select field : How to echo the label, not the value? [closed]
- ACF: get_field() returning false [closed]
- Adding custom fields to the header.php
- How to get_terms() only of terms matching an ACF meta value?
- Trying to perform complex custom field query with order by set to field value
- Get the label from ACF checkbox [closed]
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Order Custom post type loop by custom field (datepicker)
- Query pages for use of a flexible content layout
- Meta query with order by another custom field
- Can an array be used as a meta_query value?
- List of posts by day of the week
- ACF if / else checkbox [closed]
- ACF Plugin – Random Gallery Image with wp_get_attachment_image()
- Sorting custom admin column by value
- Update post meta value as date difference between two fields
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- How to orderby multiple meta fields if some fields are empty
- Get Current Post ID in functions php, meta query filter
- get all posts in custom post type by ACF field value
- Wrap Gutenberg blocks both frontend/backend (PHP approach with ACF)
- Remove the first 5 characters of the_title and orderby that
- change value of fields created with advanced custom fields in the front
- How to filter a query by multiple meta keys and order by other meta keys
- Meta query with multiple custom fields for archives page ordering problem
- Query based on custom fields start and end date
- Get image data from advanced custom field [closed]
- Check for image with same filename but different extension
- Advanced Custom Fields if else issue
- How to get both image attachment ID and url
- how make file upload field through custom field
- Advanced Custom Fields oembed only outputs YouTube URL
- Importing ACF code in other page templates
- ACF Content with WPML not saving [closed]
- Query Custom post type with Taxonomy Custom Field
- Check for duplicate custom field value before running wp_insert_post
- Adding new parent item to admin bar
- Display category multi-select with Advanced Custom Felds
- Advanced Custom Field Textarea not Showing (ListingPro Theme)
- Two problems that are likely related to AJAX
- ACF – Eliminate unnecessary data and print
- Get values from an advanced custom field
- Edit (advanced) customs fields on page template
- ACF Posts in Theme Options only returning when logged in? Bug?
- WordPress Query custom ordering by temporary variable
- Advanced Custom Fields Gallery and Flex Slider [reformuled]
- Display ACF field(s) from widget in FE
- Convert number to date format within an array
- ACF not updating value correctly
- ACF Repeater and Sort
- Advanced Custom Fields, DatePicker – Check if Set
- Acf Pro repeater field returns null when call inside foreach
- advanced custom fields plugin last input field in new posts
- WordPress loop based on url sting
- Advanced Custom Fields repeter field expiration
- WordPress/Timber/Twig – Trying to output checkbox values [closed]
- How to indicate a parent child category relationship when bulk importing
- Get ACF time in His format
- Use value from meta key array for use in WP_Query
- Filtering custom post admin listing page elements based on acf user field
- Parsing value from Lottie JSON file
- How do I add an ACF shortcode to a non-ACF page?
- Convert acf/gutenberg markup to html
- Section disappears when update pushed to production
- ACF block notice error block type is already registered – Showing error for all the block types
- Is there a security vulnerability in Advanced Custom Fields related to the SCF fork?
- Googlemap not initialising