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

get posts meta query returning the latest post if no meta key found

The meta_query parameter always need to be an array of array and should be written like this

"meta_query" => array(
     array(
         "key" => "_fixtures",
         "value" => $fixguid, 
         "compare" => "="
     )

In fact, the array of array is use to serve to any relation when you want to query multiple metas, but it’s need even you query only one.

Hope it works after !

Related Posts:

  1. Documentation for post meta
  2. Documentation for post meta
  3. get_posts( $args ) return empty data
  4. Get Posts from Custom Meta Query
  5. How to get meta value based on latest post id with group by term name
  6. Sorting not working with get_posts
  7. How to compare Event period with Week period using get_posts(), meta_query, relation and compare
  8. How to do a meta query using REST-API in WordPress 4.7+?
  9. Use REGEXP in WP_Query meta_query key
  10. Meta query terribly slow
  11. meta_query sorting by 2 keys
  12. meta_query: using BETWEEN with floats and/or casting to DECIMAL
  13. Get result from meta_query() between two numbers
  14. How to handle optional end date in compare clause in meta_query
  15. Using meta_query on pre_get_posts to exclude a particular meta_key value
  16. Meta compare with date (stored as string) not working
  17. Getting attachments by meta value
  18. Query between two meta keys
  19. Ordering posts having multiple post-meta date fields
  20. How do you get posts by meta_query using the JSON API plugin?
  21. Archives for custom post type based on a “date” meta value
  22. Query all posts where meta value is empty
  23. Custom Queries: Joining On Meta Values From Two Custom Post Types
  24. How to check a single number value against an array of meta_key values?
  25. How Can I save multiple records in same meta key?
  26. get_users meta_query
  27. Meta query with multiple logic (AND / OR)
  28. Best practice – Meta Query vs. post_clauses for “left join” ordering
  29. Meta query interfering with orderby relevance
  30. meta_query with multiple values
  31. WooCommerce conditional meta query
  32. Meta Query with date and time on the same Day before given time
  33. Different page parameters inside query
  34. Return posts with specific meta key first, but the rest in alpha order by last name
  35. How to update single value in multi dimensional Post Meta?
  36. meta_query key value from array
  37. What is an efficient way to query based on post_meta?
  38. LIKE %…% Meta Query
  39. WP_Query not working as expected for attachments and custom meta_query
  40. I can’t set meta_key in my custom post type query
  41. Multiple Values stored as array in Meta Query
  42. Order by nested named meta queries with ‘exists’ and ‘not exists’
  43. Advanced orderby with multiple meta_query
  44. Arrange Posts By Date In Order Of Closest To The Current Date
  45. Using get_terms() with meta_query parameters
  46. How can I create a WP_Query that returns posts where one meta_value
  47. WP_User_Query with meta_query array relation ‘OR’
  48. Comparisson between date() and a date from wp_postmeta
  49. WordPress altering my custom query, How to fix it?
  50. Ordering posts by anniversary using only day and month
  51. WP Meta Query for some meta (array) values
  52. Can’t sort order of wp_query with 2 meta keys
  53. Loop through two different sets of custom fields
  54. WP Query post meta value
  55. get_post_meta causes database queries
  56. How to display liked posts of current user in wordpress?
  57. How to get sum of meta_values of a meta_key in wp_query according to conditions
  58. meta_query problem
  59. Custom Upcoming Events List for Events Manager Plugin
  60. Very slow query with meta_query on large database
  61. How to use meta_query to check if a meta field has something set?
  62. Get posts by meta value with date
  63. Order posts according to user defined order for meta values?
  64. Displaying posts with only upcoming dates according their custom field date value
  65. meta_query date and time comparisons
  66. Exporting Data from WordPress into a flat table
  67. How metadata API works?
  68. Order posts by meta value and Date
  69. How to exlude posts that have certain meta_value?
  70. User Relationship
  71. Displaying Metabox value (custom post type taxonomy)
  72. meta_query results not the same with and without spaces
  73. Which is best in the following scenario : post_meta vs custom table vs parent/child posts
  74. meta_query all posts between to ages
  75. How to make a WP REST API query with meta_query in WP4.7?
  76. WordPress Core – Optimizing meta_query generated SQL?
  77. Edit post_content on posts with Featured Image
  78. Ordering posts by metadata
  79. What Is meta_id In wp_postmeta?
  80. Remove posts from query for events whose start date has passed
  81. Nested Queries using meta_query
  82. Display no post when metavalue is 0
  83. Use both meta query and tax query
  84. Wildcard with LIKE operator in Meta query
  85. Get meta info related to current post
  86. meta_query, number comparison, not quite working as it should
  87. Meta Query Compare with Date
  88. Query posts only if meta_value is not empty
  89. Query metas (and not : query posts by metas)
  90. Does meta_query working with value paramater higher then 999?
  91. meta_query keys and sticky posts
  92. Searching by meta values showing inappropriate result
  93. How to stop wp_postmeta from being called on archive and search pages?
  94. WP_POSTMETA – What do these values mean inside the data structure?
  95. How to pass user meta_key and meta_value (values as array)
  96. WP_Query ordered by meta_value_num doesn’t fetch posts without this meta field
  97. How to make Meta Query case sensitive?
  98. Performance when getting post meta for post retrieved by meta value
  99. Query Multiple values for same key
  100. Get attachment by meta_key value
Categories meta-query Tags get-posts, meta-query, post-meta
AJAX action returning empty posts array?
wp_schedule_event function reference

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