Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Search one custom field?

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:

  1. How do I use wp_query for WordPress search?
  2. filtering custom post types via meta data drop down
  3. How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
  4. Custom WP_Query for WordPress Search Results with meta_query
  5. How can you include custom post meta in search without calling each key?
  6. searching by keywords in post’s metas or pagination links problem
  7. Query postmeta values, and return multiple post_titles for common meta value
  8. Search for meta_query does not return any result if combined with title
  9. Using meta query (‘meta_query’) with a search query (‘s’)
  10. Can I exclude a post by meta key using pre_get_posts function?
  11. Advanced search form with filters for custom taxonomies and custom fields
  12. Custom post meta field effect on the performance on the post
  13. How to get custom post meta using REST API
  14. Difference between meta keys with _ and without _ [duplicate]
  15. Orderby meta_value only returns posts that have existing meta_key
  16. What is the index [0] for on post meta fields?
  17. What is “meta_input” parameter in wp_insert_post() used for?
  18. How to enable revisions for post meta data?
  19. The “_encloseme” Meta-Key Conundrum
  20. Best way to programmatically remove a category/term from a post
  21. Using get_post_meta with new_to_publish
  22. Including custom fields in search?
  23. Add custom fields to search
  24. Admin Area Custom Type Search By Meta Fields Without Title & Content
  25. Custom field metabox not showing in back-end
  26. How do I Paginate Search Results for Custom Post Types?
  27. So much data in postmeta
  28. Custom search: by post data and post metadata?
  29. Can I count the number of users matching a value in a multiple value key?
  30. Need small coding with Custom Fields Search
  31. When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
  32. How to hide meta box values from custom fields list?
  33. Auto sort the wp-admin post list by a meta key
  34. get_post_meta() unserialize issue – returns boolean(false)
  35. What is the advantage of the wp_options design pattern?
  36. Search ONLY by meta key / meta values
  37. Storing meta fields multiple times OR once with multi dimensional array?
  38. Allow user to create instances of custom field
  39. display specific custom fields
  40. Is there a hook / action that is triggered when adding or removing a post thumbnail?
  41. Filter results with custom field values and dropdown
  42. Meta keywords and descriptions plugin for manually editing meta for each page/post
  43. Add custom field (value) to search result (without plugin)
  44. passing argument to get_template_part() or a better way to code
  45. Is it possible to store arrays in a custom field?
  46. Get updated meta data after save_post hook
  47. Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
  48. Save HTML formatted data to post meta using add_post_meta()
  49. Search everything (posts, pages, tags, cpt, meta)
  50. importing data from non-wordpress mysql db
  51. Is there a way to do multiple ordering on a multiple meta_query?
  52. searching in custom meta field
  53. Create meta boxes that don’t show in custom fields
  54. Transients vs CRON +Custom Fields: Caching Data Per Post
  55. Unable to save datetime custom meta field using update_post_meta() function
  56. Up/Down voting system for WordPress
  57. post meta data clearing on autosave
  58. WordPress Search Custom Meta Field Only
  59. Create custom field on post draft or publish?
  60. Display info from custom fields in all images’ HTML
  61. Ordering posts by anniversary using only day and month
  62. Exclude custom post type from search by custom field value?
  63. get_post_meta fields don’t show up on posts page
  64. Update meta values with AJAX
  65. How to break meta values into different items and avoid duplicates?
  66. copy attachments to another post type and change attachment url
  67. Cannot edit post meta fields with rest API
  68. ajax delete value from custom field array
  69. Save attachment custom fields on front end
  70. How to use pagination with get_post_meta
  71. Copying Custom Meta Values from existing post to a duplicate post
  72. Add a post meta key and value only if it does not exist on the post
  73. Move value of one custom field to another
  74. Order posts according to user defined order for meta values?
  75. Displaying posts with only upcoming dates according their custom field date value
  76. Custom fields to save multiple values
  77. Custom fields: In what order are they saved into the DB?
  78. Function to change meta value in database for each post
  79. Get a post_id where meta_value equals something in a serialized meta_value field
  80. Get aggregate list of all custom fields for entire blog
  81. Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
  82. Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
  83. Custom field value based on other custom field values
  84. wp_handle_upload error “Specified file failed upload test” but still creates attachment?
  85. How to save a ToggleControl value in a meta field?
  86. Extend ‘The Events Calendar’ search to include custom fields [closed]
  87. Include woocommerce custom field value in front-end search result
  88. Which is best in the following scenario : post_meta vs custom table vs parent/child posts
  89. Saving custom image meta fields
  90. Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
  91. Including Database Generated Pages in Site Search [closed]
  92. How to display Meta Field Value?
  93. MySQL query to set wp_postmeta using term_taxonomy_id value
  94. How to Validate Post Meta type/extension (Video File Image File etc)
  95. Get all meta keys assigned to a post type
  96. Adding Custom Fields to Search
  97. using multiple meta_key and meta_value in query_posts
  98. Custom Meta Box not Saving in Posts with Gutenberg Editor
  99. sort search results by custom fields using dropdown
  100. Using a checklist to search against metadata
Categories custom-field Tags custom-field, post-meta, search
Show comon custom field results?
Search and replace post URL’s on page output?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress