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

Multiple meta key and value search in the query

You don’t have any conditions for “any” as a given value in your code, so it won’t be treated as any, but as “any”.

But your code checks if given value is not empty, so passing it like so should work:

api.php?key=fruit,drink&value=,whiskey

PS. I’m not sure if that’s the best way of passing arguments to your api 😉

Related Posts:

  1. WP_POSTMETA – What do these values mean inside the data structure?
  2. I can not display meta value in extras.php and template-tags.php
  3. Negative meta_query if storing multiple post_meta values with shared meta_key
  4. How to get posts by meta value as multi-dimensional array?
  5. How to extract data from a post meta serialized array?
  6. Meta compare with date (stored as string) not working
  7. How to get all term meta for a taxonomy – getting term_meta for taxonomy
  8. How to update single value in multi dimensional Post Meta?
  9. How to store post meta in an array?
  10. WP Meta Query for some meta (array) values
  11. How metadata API works?
  12. Job of meta_key meta_value fields in database tables
  13. order by multiple meta_keys?
  14. How to get the total number of meta_values based on a custom post type?
  15. How to stop wp_postmeta from being called on archive and search pages?
  16. get_*_meta doesn’t always return an array
  17. Run a check for multiple meta key values
  18. Unset field from an array not working as expected
  19. How can I convert postmeta from unserialized to serialized?
  20. How to create a meta_query to get all posts with a specific meta data?
  21. Compare meta_query with a Regular Expression and do a less-than operation on it
  22. $wpdb class updating meta_value using Ajax [closed]
  23. Post meta as array looks like string instead of array
  24. Grouping posts by a custom meta value
  25. Time & Date on Post – Time Ago Custom Function
  26. Should I save this mulit dementional arary as one post meta?
  27. How to check if a post meta key/value pair already exists for a specific post
  28. Can A Post Meta Field Store multiple values that are not in an array?
  29. Order by meta value pro first then meta value free in my search function
  30. why after saving meta value it’s saving all the values the one that i clicked?
  31. change order of images attached to post
  32. Print specific values stored in a post meta array
  33. Is it safe to add a new field to meta_value field?
  34. How can I use ‘orderby’ => ‘meta_value_num’ to order by the numerical value even if the value starts with a word?
  35. Array of user ids to list of user names
  36. get Insert id for meta field
  37. Filter posts by meta key
  38. Display current ranking of post as a number in post title
  39. Search post overlapping dates – meta_query with meta_key
  40. How can I query for posts using a date stored in post-meta?
  41. update_post_meta() updating nested array in Multidimensional array with empty sub-array
  42. Count Post and Page Views based on meta_value Using Shortcode in Dashboard Widget
  43. How can I update this array built from post meta data?
  44. What format is this and how to get value “lal” and “pila” from it
  45. if get_post_meta function returns empty – Do Not Display HTML
  46. Trouble with serialized metadata
  47. How to get the total of two meta values from different meta keys?
  48. How to save a meta_value as a numeric value after I retrieve it via update_post_meta?
  49. How to update/add child posts meta whenever the parent post meta is updated?
  50. Combine meta query and give a specific meta query a higher priority
  51. WordPress meta query with meta serialized data array value
  52. Reading Content in an Array as it relates to a meta_query
  53. Optimize WP Meta Query for large amount of post meta?
  54. Multiple postmeta values to the same post_id/meta_key combination?
  55. How to sort by meta value num, but ignore zero value?
  56. Plugin Shortcode value in post
  57. Retrieve posts from meta key
  58. Fetching array of postmeta with $wpdb and in_array conditional
  59. How to show specific meta keys of all posts in admin panel?
  60. How to create a link for wordpress meta datas?
  61. wp_postmeta store multiple values in one key [closed]
  62. How we insert values into database using metabox WordPress?
  63. Check for custom field value in different post type than current one and do something
  64. WP Query Args – search by meta_key or title
  65. Update post meta array – add new, single value
  66. Saving zero as meta value
  67. Get a row from a separate table by matching a posts meta_key to a tables ID column
  68. Reset/delete post views meta/custom field after X hours or minutes or seconds
  69. Have lots of meta for posts, is it better to get at all at once or each individually
  70. IF Custom field value equals ZERO
  71. Query posts WITHOUT a custom meta field
  72. Add box with custom per-page properties
  73. get_post_meta not working when variable used for post ID
  74. Update post meta dynamically
  75. Need a SQL query to update meta_key=’_price’ with value in meta_key=’_regular_price’
  76. Display current user’s custom post meta in sidebar
  77. add_post_meta doesn’t work
  78. How to get single value from get_post_meta() array of values?
  79. wordpress update multiple posts post meta
  80. get_template_part() isn’t loading author information
  81. WP_Query meta compare must include ALL array values
  82. Format meta_value [closed]
  83. wp query to use both author id and meta_query
  84. URL from get_post_meta() is broken my URL
  85. Custom Meta Box: Value saved in WordPress DB, but not shown in input field on Edit Screen
  86. get_post_meta and add_post_meta not working
  87. Export media library with metadata and import into new blog
  88. Trouble with calling an imploded variable in an array
  89. Why doesn’t wp_oembed_get() for the video post format not work?
  90. Custom Meta Fields that are Echo’d are removed on post update?
  91. How to add dynamic content in title and meta description in wordpress theme for homepage, post page, category, tag and pages
  92. add_post_meta only adding 1 character
  93. How to get several fields from wp_query?
  94. Posts with no meta field do not appear when sorting by meta field
  95. query with custom field
  96. Using Form to alter PHP variable [closed]
  97. Chance post id into post name
  98. Multipe array in meta_input
  99. getEntityRecords/useEntityRecords: How to use CPT metadata?
  100. How to update post view count?
Categories post-meta Tags array, meta-query, meta-value, post-meta
WordPress numeric (yearly) page names / disable yearly archives
Shortcode not interpreted if parameter set

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