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

Query posts by searching for a string in a meta field

First of all – I assume the $search variable is being populated from $_GET (it’s not in your code).

Secondly, do you need the % ? I think using LIKE with wp_query doesn’t require them.

Related Posts:

  1. Use REGEXP in WP_Query meta_query key
  2. Getting attachments by meta value
  3. What is an efficient way to query based on post_meta?
  4. WP_Query not working as expected for attachments and custom meta_query
  5. How can I create a WP_Query that returns posts where one meta_value
  6. WordPress altering my custom query, How to fix it?
  7. WP Meta Query for some meta (array) values
  8. How to get sum of meta_values of a meta_key in wp_query according to conditions
  9. Order posts by meta value and Date
  10. Get meta info related to current post
  11. How to make Meta Query case sensitive?
  12. Performance when getting post meta for post retrieved by meta value
  13. Get attachment by meta_key value
  14. Fetch Record based on meta key dates
  15. how to make members list directory through wordpress post custom meta key.
  16. Large AND OR query timing out
  17. Filter posts by comparing custom meta value against postdate
  18. Nested array issue in meta_query
  19. WP_Query meta compare must include ALL array values
  20. How do i create a custom post query when the meta value is an array?
  21. wp query to use both author id and meta_query
  22. Meta query ignores multiple values of the key
  23. Trouble with serialized metadata
  24. show most viewed post
  25. Why can my filter query SOME metadata but not other metadata?
  26. Query against multiple locations within single custom post type post
  27. How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
  28. Saving custom fields for WP_Query to retrieve
  29. How to show all the associated posts with specific date of data metabox?
  30. WP Meta Query at depth 2
  31. WP_Query Posts by Metadata from Option Tree
  32. Return a single custom post from multiple meta queries
  33. WP_Query by meta key not returning any posts
  34. Meta_query compare operator explanation
  35. meta_query with meta values as serialize arrays
  36. How to only display posts whose meta_value field is not empty?
  37. Nested meta_query with multiple relation keys
  38. Can wp_query return posts meta in a single request?
  39. order by numeric value for meta value
  40. meta_query ‘compare’ => ‘IN’ not working
  41. How do I query for posts by partial meta key?
  42. WP Query Args – Title or Meta Value
  43. Meta query with string starting like pattern
  44. compare meta_query in get_posts arguments
  45. WordPress retrieving meta data for all custom post types in list view
  46. How to query posts based on lat-lng coordinate as post meta?
  47. how to show posts that are missing a meta_value
  48. Order by optional meta key?
  49. Set Alias for meta_query arguments in get_posts()
  50. Sorting: custom query with orderby meta_value_num THEN by title
  51. meta_query: using BETWEEN with floats and/or casting to DECIMAL
  52. Display products from specific category in shop page
  53. Reduce or prevent calling of update_meta_cache
  54. Is there a way to extend WP_query so Custom Post Types can have properties?
  55. How to Compare Two Meta Fields
  56. Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
  57. Does tax_query really beats meta_query in all situations?
  58. WP_Query with checkbox meta_query
  59. ACF Relationship Field Search Filtering [closed]
  60. What is the most efficient way of querying posts based on visits and date for current day?
  61. Add indexing to meta_value in wp_postmeta
  62. Is it possible to orderby multiple meta_keys when using meta_value_num?
  63. Custom WP_Query order by post_meta and (author) user_meta
  64. Query WooCommerce orders where meta data does not exist
  65. Query Multiple Post types each with own meta query
  66. WP_Query displaying ALL posts
  67. Execute a large WP_Query with many “AND” Meta_Queries?
  68. Query all posts where meta value is empty
  69. meta_query where value is equal to given value
  70. WP_Query min and max values
  71. Query Custom Meta Value with Increment
  72. WP-CLI How to generate a list of posts with corresponding meta values
  73. ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
  74. WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
  75. Using custom meta_query with relation not working as expected
  76. Perform query with meta_value date
  77. querying with custom meta field with meta_query
  78. Order by two meta keys
  79. multiple meta key but get server load is very high
  80. Meta Query with date and time on the same Day before given time
  81. A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
  82. How to grab metabox value in wp_query meta_query key
  83. WP_Query meta_query where meta value ends in space
  84. Order by meta_value_num DESC and meta_value ASC on WP 4.0
  85. Finding all results from database within 500 miles of the given latitude and longitude [closed]
  86. Nested query inside Logical operator OR not working in meta_query
  87. Is “orderby” in WP Meta Query conflicting with Meta Query?
  88. Query by meta_key and order by meta_value_num return orderby date
  89. datetime picker, timestamps and meta queries
  90. How do I create my own nested meta_query using posts_where / posts_join?
  91. How to count post meta key values for all posts in database
  92. WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
  93. How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
  94. Group posts by meta_key
  95. How should I use posts_where to change meta_value from a string to integer?
  96. Compare two meta-fields in a wp_query (where meta-field-A is larger than meta-field-B)
  97. Wp_query order by multiple custom fields?
  98. Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1
  99. Comparisson between date() and a date from wp_postmeta
  100. Can’t sort order of wp_query with 2 meta keys
Categories wp-query Tags meta-query, post-meta, wp-query
index.php file in wp-content/themes/ folder
Buddypress – adding profile fields to Group > Members directory [closed]

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