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

Woocommerce: order posts by meta key

meta_query should be an array of arrays like:

...
'meta_query' => [
    [
        'key' => '...',
        'value' => '...',
    ],
],
...

Related Posts:

  1. meta_query: using BETWEEN with floats and/or casting to DECIMAL
  2. WP Query post meta value
  3. get_post_meta slowing down my page load (in a plugin)
  4. get_posts return only first result
  5. update_post_meta performance in a loop woocommerce
  6. update_post_meta performance in a loop woocommerce
  7. Get posts with any value in attribute
  8. When should you use WP_Query vs query_posts() vs get_posts()?
  9. When to use WP_query(), query_posts() and pre_get_posts
  10. How to only display posts whose meta_value field is not empty?
  11. Can wp_query return posts meta in a single request?
  12. order by numeric value for meta value
  13. How do I query for posts by partial meta key?
  14. Use REGEXP in WP_Query meta_query key
  15. WordPress retrieving meta data for all custom post types in list view
  16. How to use the_posts_navigation for wp_query and get_posts?
  17. WP_Query vs get_posts
  18. Order by optional meta key?
  19. Get posts from Network (Multisite)
  20. WP_Query: Exclude hidden products from WooCommerce product list
  21. How to order by post_status?
  22. Using get_posts vs. WP_Query
  23. Delete all posts from WordPress except latest X posts
  24. Reduce or prevent calling of update_meta_cache
  25. How to query only for products with status “in stock” in WooCommerce? [closed]
  26. Is there a way to extend WP_query so Custom Post Types can have properties?
  27. Sanitation needed for WP_Query or get_posts calls?
  28. Differences Between WP_Query() and get_posts() for Querying Posts?
  29. What is the most efficient way of querying posts based on visits and date for current day?
  30. Get Recent Posts by Date in Multisite
  31. get_posts with multiple categories
  32. Query WooCommerce orders where meta data does not exist
  33. get_template_part in for loop
  34. Use of caller_ get_ posts
  35. Getting attachments by meta value
  36. WP_Query for WooCommerce Products
  37. WP_Query displaying ALL posts
  38. How-to exclude terms from the main query the most performant way?
  39. Is it possible to select against a post’s parent’s fields with WP_Query?
  40. Query all posts where meta value is empty
  41. meta_query where value is equal to given value
  42. Query Custom Meta Value with Increment
  43. WP-CLI How to generate a list of posts with corresponding meta values
  44. Changing a theme’s search function to only show results from woocommerce?
  45. Get WooCommerce best selling products for the current month [closed]
  46. Get posts by meta data OR title
  47. Get_post() with meta_key when compare is a date
  48. get_posts not finding argument: post_name
  49. Meta Query with date and time on the same Day before given time
  50. Woocommerce query by price range and custom meta key
  51. Get posts with condition on comment meta value
  52. What is an efficient way to query based on post_meta?
  53. WP_Query not working as expected for attachments and custom meta_query
  54. Function to check if author has posted within the last x days
  55. How to count post meta key values for all posts in database
  56. Use post__in and post__not_in together?
  57. WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
  58. Group posts by meta_key
  59. What should I use, get_posts or wp_query for less CPU load?
  60. How should I use posts_where to change meta_value from a string to integer?
  61. Different Results with query(‘s=computer’) vs get_posts(‘s=computer’)?
  62. How to get post from all Blog Multisite to the Main Site?
  63. Retrieve products with specific attribute and in category – woocommerce
  64. How to combine tax_query and date_query in WordPress
  65. How can I create a WP_Query that returns posts where one meta_value
  66. how to retrieve specific product attribute value in an sql query?
  67. WordPress altering my custom query, How to fix it?
  68. WP Meta Query for some meta (array) values
  69. Query for posts from any post type but only add instock products
  70. Get all posts without tags
  71. Would this post meta be better added to the post table rather than post_meta table
  72. Custom URl parameter
  73. query posts in functions.php and update a field
  74. get_posts() seemingly ignoring post_type
  75. Compile meta values from custom loop into array and then calculate sum total
  76. Can not switch the queried post in pre_get_posts hook
  77. How to get sum of meta_values of a meta_key in wp_query according to conditions
  78. Find all product that contain terms with %keywords% in WP_Query
  79. how to fire join query with post_meta
  80. How to find out what “Blog pages show at most” is set to [duplicate]
  81. Display featured products through custom loop in WooCommerce 3 [closed]
  82. Count posts returned by get_posts in external PHP script
  83. Best approach to create Hot and Trending sections
  84. WP_Query, custom sort and custom filter
  85. WP Query – Get WooCommerce Products with variation that is in stock
  86. Trying to check and see if a post has a featured image outside of the main loop
  87. WP_query category__in not working, only pulls from first category
  88. Search product by brand name in wp_query
  89. Get product list of given category
  90. Order posts by meta value and Date
  91. SELECT * FROM $wpdb->posts WHERE ID > 160
  92. Efficient way to update multiple post meta
  93. How to exclude products by tag from woocommerce shop page?
  94. How to make orderby ‘meta_value_num’ OPTIONAL?
  95. Query Posts depends on custom field inside repeater field using acf
  96. Adding multiple post queries with parent and children to page – Best Way
  97. WooCommerce Only OnSale Products Loop Snippet [closed]
  98. How do you Query posts with nothing in common?
  99. Query post with meta_query where date is not in future
  100. WP_Query, tax_query and term_meta: How to?
Categories wp-query Tags get-posts, post-meta, woocommerce-offtopic, wp-query
Update WP option by plugin
Use of domain name

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