Assuming you are using post_meta this should help::
$color="red";
$the_query = new WP_Query(array( 'meta_key' => 'color', 'meta_value' => $color ));
Related Posts:
- How do I use wp_query for WordPress search?
- filtering custom post types via meta data drop down
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Custom WP_Query for WordPress Search Results with meta_query
- How can you include custom post meta in search without calling each key?
- searching by keywords in post’s metas or pagination links problem
- Query postmeta values, and return multiple post_titles for common meta value
- Search for meta_query does not return any result if combined with title
- Can I exclude a post by meta key using pre_get_posts function?
- What is the index [0] for on post meta fields?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Custom field metabox not showing in back-end
- So much data in postmeta
- Custom search: by post data and post metadata?
- Need small coding with Custom Fields Search
- How to hide meta box values from custom fields list?
- get_post_meta() unserialize issue – returns boolean(false)
- What is the advantage of the wp_options design pattern?
- Search ONLY by meta key / meta values
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- Search everything (posts, pages, tags, cpt, meta)
- Up/Down voting system for WordPress
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- Create custom field on post draft or publish?
- Display info from custom fields in all images’ HTML
- Update meta values with AJAX
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Add a post meta key and value only if it does not exist on the post
- Custom fields to save multiple values
- Function to change meta value in database for each post
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- Extend ‘The Events Calendar’ search to include custom fields [closed]
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Saving custom image meta fields
- Get all meta keys assigned to a post type
- sort search results by custom fields using dropdown
- Using a checklist to search against metadata
- Adding custom fields (post meta) before/during wp_insert_post()
- How to query posts with certain custom meta data, and output Post data
- Custom Fields Not in Search Results
- ACF: How to get the full field name (meta_key) by a field key?
- post meta getting deleted on save
- Custom field not updating when value is empty
- meta_compare seems to be treating values as strings instead of integers as expected
- Limit the number of acf content when displaying in post loop [closed]
- How to add custom metadata text box dropdown to sidebar in Gutenberg editor for all post types
- Add post meta fields, when creating a post using WordPress’ REST API
- Store array as single, serialized post meta field or many post meta fields?
- Custom Field Values not updating unless I click “Update” twice
- update_post_meta for repeated custom field [closed]
- Trying to update_post_meta function
- Show values of custom post meta on ‘Add new post’ page?
- Custom post meta field effect on the performance on the post
- get_posts in meta box dropdown not showing latest posts
- Limits, not all post are showen when querying for posts by view count
- Display Custom Meta Box Field Only If Value is Present
- Ordering posts by custom field named “date” in backend
- Stop sending email everytime I updates my post
- Best way to store everyday post views?
- Custom meta is not being saved
- How to use media upload on metabox post page without breaking TinyMCE?
- Branch made by several custom values
- Looping inside block return
- change order of images attached to post
- how can I show name and value of Custom Fields together?
- Can I save post meta programatically without setting metaboxes?
- Insert image into sub-field with update_post_meta
- Gravity Forms Update post meta from template [closed]
- Best way to achieve multiple links in a post title
- How can I add/update post meta in a admin menu page?
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- custom filed from post in the side bar
- wordpress multi user question
- Type character in name and make it invisble
- Adding Custom Metadata to my Archive/Posts page
- How to improve my non-unique metadata MySQL entries?
- search based on custom field
- Custom Fields Not Showing (ACF not installed)
- SQL query to change the value of a Custom Field
- Custom meta POST request fired twice when updating a post in Gutenberg
- Add custom field information to source meta data
- How do I update custom field post meta in frontend post template?
- How to Find List of Available Custom Fields for Theme?
- Create Meta boxes dynamically
- Custom Fields Not Working In Footer
- ACF plugin and field update
- Delete custom meta
- change attachment custom field onChange event
- Custom Search Query – include only custom fields and title
- wordpress simple post multi rating with post_meta and user_meta
- wp_postmeta are updated for only one page
- Advanced search form with filters for custom taxonomies and custom fields
- Custom search with meta fields
- Custom fields / meta box output
- Colecting values from custom field checkboxes and displaying them in the post
- Build Array from Input Fields question
- How can i put a custom field inside this php
- Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)