$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:
- Order by meta value or date?
- Filtering posts by post meta data
- Query Custom Meta Value with Increment
- Problem with ‘post__not_in’
- Sort X categories by last update and show image
- using post__in allow duplicate post id
- Using dynamic conditions in ‘posts_where’ filter
- How to limit search to first letter of title?
- Custom query with query_posts doesn’t show post without certain meta_key
- Counter code for paginated category pages in wordpress
- WordPress Search Filter Only for Page with Child of Child of Child of Child of Child
- How to sort by meta value?
- pagination in author.php template returns 404 error
- get_post_meta causes database queries
- How to display liked posts of current user in wordpress?
- How to modify the query to exclude posts by slug?
- Dynamically excluding current page id
- Querying posts with meta value that begins with a certain pattern
- Adding Variables to post query
- How can I sort homepage by a meta value?
- Tricky WP Query
- IF.. post meta show… Conditional Tag Help…?
- query_posts() ALWAYS displays something?
- order posts by meta value on posts page
- Query_post($args)
- Using ajax with paging and a custom sub-query
- query_posts() on key’s value, or key’s existence
- How to retrieve an array of post IDs by a particular value stored in a custom meta’s array
- Query posts by meta_key whose value is an array
- Each post is showing twice in my custom query…?
- Frontend form with multiple posts
- How exclude 3 latest posts of a category in query_posts
- query_posts orderby postmeta [closed]
- Can I use WP_Query one time and then filter the results multiple times
- Different layout based on post amount?
- How to solve this without flushing the rewrite rules for each post query the visitor triggers?
- How to check a list or feed of all posts under a category and tag?
- Best Query for blog posts
- I need query_posts() to order results first by a meta value and then by post ID
- Ordering Posts By Meta Data
- Ordering posts alphabetically by meta keys and title
- How to query post ids liked by the Author
- Adding Category Argument into an Array for WordPress Query
- get all posts with certain meta data
- Limiting the amount of posts this displays
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to Get All Posts with any post status?
- posts_per_page no limit
- what is the correct way to compare dates in a WP query_posts meta_query
- How can i get count from query post
- order by numeric value for meta value
- query_post by title?
- Why query_posts() isn’t marked as deprecated?
- Alternative to query_posts for main loop? [duplicate]
- Wp get all the sub pages of the parent using wp query
- how to query posts by category and tag?
- Using WP_Query to Query Multiple Categories with Limited Posts Per Category?
- Get the ID of the latest post
- How to query for most viewed posts and show top 5
- How do I query by post format in WordPress 3.1
- Display posts of the last 7 days
- Is there a way to exclude the content from the post variable to save on RAM usage?
- WP_Query vs get_posts
- How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?
- Query posts by custom taxonomy ID
- Display/query post formats
- How to query post by user role?
- How to return results of a get_posts() in explicitly defined order
- Help to condense/optimize some working code
- What is the most efficient way of querying posts based on visits and date for current day?
- How to set posts per page using WP_Query()
- query_posts exclude a meta key
- How do I create a random post that will last for a day
- Ensuring sticky posts are retrieved first (without using two queries)?
- Determine if more posts are available than was asked for in `query_posts()`?
- Modify main WordPress loop with a parse_query filter
- Search custom post type by meta data
- query_posts() in function makes global $wp_query out of sync?
- Limiting query_posts to 1, regardless of sticky post?
- How to make “sticky” pages (and query by them)
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Query posts: how to exclude results if post is in multiple categories
- query_posts ->using meta_compare / where meta value is smaller or greater or equals
- Is `query_posts` really slower than secondary query?
- How to order posts by descending comment count on taxonomy page?
- Are there any scenarios where the query_posts may be used?
- List posts by category exclude current post
- Alter query on edit.php
- Get posts by meta data OR title
- Sort posts alphabetically by custom field value, insert divider between different letters
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- WP 5.8 “Query Loop” block: where to place custom query?
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- Custom Post Type “Event”: chronological list of recurring events
- Pagination on archive.php page
- WPDB Multiple site’s posts and get featured images
- WordPress Custom Query
- Best way to load page content in Fancybox popup?
- How should I intercept the main query and inject custom join / order by / group by criteria