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

Exclude posts by post meta value

$args = array(
   'meta_key'   => 'home_post_id',
   'orderby'    => 'meta_value_num',
   'order'      => 'DESC',
   'meta_query' => array(
       array(
           'key'     => 'home_post_id',
           'value'   => 0,
           'compare' => '>',
           'type'    => 'numeric',
       )
   )
);
query_posts($args);

Something like this should work but I haven’t tested it .)
Let me know if it works..

Reference: WP_Query – Custom Field Parameters

Related Posts:

  1. Order by meta value or date?
  2. Filtering posts by post meta data
  3. Query Custom Meta Value with Increment
  4. Problem with ‘post__not_in’
  5. Sort X categories by last update and show image
  6. using post__in allow duplicate post id
  7. Using dynamic conditions in ‘posts_where’ filter
  8. How to limit search to first letter of title?
  9. Custom query with query_posts doesn’t show post without certain meta_key
  10. Counter code for paginated category pages in wordpress
  11. WordPress Search Filter Only for Page with Child of Child of Child of Child of Child
  12. How to sort by meta value?
  13. pagination in author.php template returns 404 error
  14. get_post_meta causes database queries
  15. How to display liked posts of current user in wordpress?
  16. How to modify the query to exclude posts by slug?
  17. Dynamically excluding current page id
  18. Querying posts with meta value that begins with a certain pattern
  19. Adding Variables to post query
  20. How can I sort homepage by a meta value?
  21. Tricky WP Query
  22. IF.. post meta show… Conditional Tag Help…?
  23. query_posts() ALWAYS displays something?
  24. order posts by meta value on posts page
  25. Query_post($args)
  26. Using ajax with paging and a custom sub-query
  27. query_posts() on key’s value, or key’s existence
  28. How to retrieve an array of post IDs by a particular value stored in a custom meta’s array
  29. Query posts by meta_key whose value is an array
  30. Each post is showing twice in my custom query…?
  31. Frontend form with multiple posts
  32. How exclude 3 latest posts of a category in query_posts
  33. query_posts orderby postmeta [closed]
  34. Can I use WP_Query one time and then filter the results multiple times
  35. Different layout based on post amount?
  36. How to solve this without flushing the rewrite rules for each post query the visitor triggers?
  37. How to check a list or feed of all posts under a category and tag?
  38. Best Query for blog posts
  39. I need query_posts() to order results first by a meta value and then by post ID
  40. Ordering Posts By Meta Data
  41. Ordering posts alphabetically by meta keys and title
  42. How to query post ids liked by the Author
  43. Adding Category Argument into an Array for WordPress Query
  44. get all posts with certain meta data
  45. Limiting the amount of posts this displays
  46. When should you use WP_Query vs query_posts() vs get_posts()?
  47. How to Get All Posts with any post status?
  48. posts_per_page no limit
  49. what is the correct way to compare dates in a WP query_posts meta_query
  50. How can i get count from query post
  51. order by numeric value for meta value
  52. query_post by title?
  53. Why query_posts() isn’t marked as deprecated?
  54. Alternative to query_posts for main loop? [duplicate]
  55. Wp get all the sub pages of the parent using wp query
  56. how to query posts by category and tag?
  57. Using WP_Query to Query Multiple Categories with Limited Posts Per Category?
  58. Get the ID of the latest post
  59. How to query for most viewed posts and show top 5
  60. How do I query by post format in WordPress 3.1
  61. Display posts of the last 7 days
  62. Is there a way to exclude the content from the post variable to save on RAM usage?
  63. WP_Query vs get_posts
  64. How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?
  65. Query posts by custom taxonomy ID
  66. Display/query post formats
  67. How to query post by user role?
  68. How to return results of a get_posts() in explicitly defined order
  69. Help to condense/optimize some working code
  70. What is the most efficient way of querying posts based on visits and date for current day?
  71. How to set posts per page using WP_Query()
  72. query_posts exclude a meta key
  73. How do I create a random post that will last for a day
  74. Ensuring sticky posts are retrieved first (without using two queries)?
  75. Determine if more posts are available than was asked for in `query_posts()`?
  76. Modify main WordPress loop with a parse_query filter
  77. Search custom post type by meta data
  78. query_posts() in function makes global $wp_query out of sync?
  79. Limiting query_posts to 1, regardless of sticky post?
  80. How to make “sticky” pages (and query by them)
  81. Custom Queries: Joining On Meta Values From Two Custom Post Types
  82. Query posts: how to exclude results if post is in multiple categories
  83. query_posts ->using meta_compare / where meta value is smaller or greater or equals
  84. Is `query_posts` really slower than secondary query?
  85. How to order posts by descending comment count on taxonomy page?
  86. Are there any scenarios where the query_posts may be used?
  87. List posts by category exclude current post
  88. Alter query on edit.php
  89. Get posts by meta data OR title
  90. Sort posts alphabetically by custom field value, insert divider between different letters
  91. Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
  92. WP 5.8 “Query Loop” block: where to place custom query?
  93. Perform query with meta_value date
  94. WP_Query ordered by custom field that is a date string?
  95. Custom Post Type “Event”: chronological list of recurring events
  96. Pagination on archive.php page
  97. WPDB Multiple site’s posts and get featured images
  98. WordPress Custom Query
  99. Best way to load page content in Fancybox popup?
  100. How should I intercept the main query and inject custom join / order by / group by criteria
Categories query-posts Tags exclude, post-meta, query, query-posts
Redirect from ip to domain
Auto-Tweet if Type is ‘Status’ using OAuth

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