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]
- ORDER BY custom field value
- Sorting: custom query with orderby meta_value_num THEN by title
- Order get_terms using a Custom Field
- Ordering posts having multiple post-meta date fields
- Order Posts by Taxonomy and Meta Value
- wordpress REST-API upload image to ACF
- meta_query with array as value
- Vimeo thumbnails [closed]
- Query between dates using date picker filter breaks in WordPress 4.2.1
- Get ACF value after update user using save_post
- random p tag in advanced custom fields?
- How can I track and output when a field is updated? (currently using Advanced Custom Fields)
- Custom query based on meta key – Reduce three states to two in results?
- WP_Query ordered by meta_value_num doesn’t fetch posts without this meta field
- Add up values from ACF number field
- Advanced Custom Fields: Conditional Statement with Select
- Add PDF to ACF image field from file url
- Bulk-Update Custom Posts
- Group ACF repeater fields from differrent posts
- Help ordering Post loop by two meta values
- ACF Add fields values to newly inserted post [closed]
- WordPress Screwing Up ‘orderby’ => ‘meta_value_num’ in ‘pre_get_posts’
- Programatically re-order images in the ACF gallery add-on. Orderby Title, ID, etc
- How to add/edit advanced custom fields on custom post type’s WordPress REST API?
- Use ACF select field to add a class to div inside a flexible content layout [closed]
- Website goes down while importing backup (Internal server 500)
- ACF: If field contain a specific value, update value in another field programatically
- how to load random related posts with specific custom fields?
- JSON – Create rest api endpoint for Advanced Custom Fields
- ACF – Pick first or second value from comma separated values
- post values to custom post type which has advanced custom fields
- ACF Image field not displaying in WordPress with Visual Composer [closed]
- Custom query filter by ACF date custom field
- How to acquire an ACF image using get_previous_post and get_next_post
- Building large multi-section pages with Advanced Custom Fields
- Showing a post depending on the Custom Field value
- Widget Code / Advanced Custom Fields / Elementor
- How can I apply an ACF field to a single custom post if it refers to the taxomy of that post type in the rules?
- Getting “Years Only ” from ACF Date Picker field to Hidden filed in the fields group
- Need to check if user has completed a woo commerce payment
- How to show related post having same relationship filed under single CPT?
- Trying to update repeater field (ACF) dynamically with data from Contact Forms 7
- Get title color from category custom field
- wp rest api orderby field in a custom table
- WP Cron Working, but Function Not Working
- How to get a product’s Custom Fields in a different template file?
- pre_get_posts hook not targeting search results page query
- ACF – get custom taxonomy term image field
- ACF group field disappeared after deployment using deployer script
- ACF Dynamic select not showing data
- Modification of RSS feed is not consistent
- How to use WP Backery on Wysiwyg ACF
- Looking for a javascript callback action to re-initiate a custom slideshow in gutenberg
- Hide Menu Items from guess user with ACF
- Advanced Custom Fields Gallery and Flex Slider [closed]
- Help using an array in ‘exclude’ key of another array
- Sorting with meta_query and multiple, optional meta keys
- Build table using Advanced Custom Fields
- Front page showing ACF only once, is that solvable to show the ACF per post? [closed]
- Add column and acf field content for cpt
- Can’t get ACF repeater data in category template
- Using orderby with 2 meta keys
- Multiple loop issue – pull one featured and then continue the loop
- Check if meta_key exists in wp_list_pages
- ACF + WPML: How to translate date fields?
- Using ACF custom field for custom post type to order categories
- PHP calls to custom fields not being made. Query seems to be blocking them
- Get posts using multiple values from ACF checkbox as meta query wordpress
- Advanced Custom Fields – Issue with Slick Slider in ACF v6 Block
- How can I update an ACF field in a repeater on post save?