Basically, I am reading right out of the Codex page for WP_Query
.
You want a meta_query
similar to this with an orderby
parameter with the two values you want to order by. The first is dominant.
$args = array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'rating',
'value' => 3,
'compare' => '>'
)
),
'orderby' => 'rating post_date',
'order' => 'DESC'
);
$query = new WP_Query( $args );
I don’t know what your rating
field is named and I don’t have your posts and your ratings on my system so I can’t test that. Hopefully that will get you started.
Related Posts:
- WP_Query sort by meta_value_num or date
- WP_Query orderby not working with meta_value_num and menu_order
- Creating Ordered Query using Meta_key
- How do I reorder (pop and push) items from WP_Query?
- Update all posts automatically when using post_meta
- Reverse chronology of post listing
- Better post meta efficiency?
- Change post format using custom field
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- What Is meta_id In wp_postmeta?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- Automatic value for custom fields for posts
- is there a way to show the the post title after the image?
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- Query Posts With Over 1000 Views
- Cannot retrieve a custom RSS field from posts
- How to order posts by meta_value and title
- Query Posts by Custom Field
- how to get post order by post id wp_query?
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- Create a list of posts with topic headdings
- if in category but only with post meta
- wp_query with ajax
- Saving Post Data in Another Database
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Add multiple meta keys to a post at once
- WP_Query custom field pass the post id
- saving/reading custom field value does not work – no value gets POSTed
- Override WordPress core post-template.php block template
- Post meta not working
- query posts with selected post ids first
- How do you update post date (year only) in a separate custom field?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- How do I display posts ordered by a date custom field?
- Random order of the 5 most popular posts
- My custom query is displaying random posts in random order
- Get query result according to merged array
- Show posts between two Custom Fields date
- WP Query between posts custom fields [duplicate]
- Order posts by separate menu order for different sub-categories
- Order by ‘s’ using WP_Query()
- How enter custom post meta or custom field on box post list archive page?
- WP_query sort by custom meta_key “price”
- Image inside the content is replaced with featured image from my older post
- Order by Post Title in WP Query not working
- How to bulk Update URLs to new values?
- Select another post in a post meta like a parent page is selected while editing a page
- SQL DELETE multiple post_meta on single and multi-sites
- Change Old WordPress Post Date Year
- How to create loop of posts except post ID defined via ACF field
- Displaying all posts from other sites on the network on one site
- the wp_post_update isn’t working all the time
- Trouble with serialized metadata
- Function is printing twice – any suggestions?
- Query on a repeater date (acf)
- Adding an option to post editor to show a site disclaimer or message
- Display/Filter post using if else statement
- How to sort WP_Post Object array by object field in php?
- Search results for ACF data
- Multisite how to display merged posts from two sites and sort by latest date?
- Saving canvas generated image when saving post causes 404 error
- Query prints posts without specific categories
- Private post caught in endless redirect loop
- Show posts from WP Custom Post Type selected from a field in a metabox
- How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
- What is proper filter or hook action to add data to the $post object?
- Display specific posts based on an ID of another post
- SEARCH QUERIES – REVERSE OUTPUT
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Order by meta_key field in WordPress not meta_value field value
- a WordPress connected to 2 database
- How to display particular set of wordpress post on a webpage?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Change URL of previous posts and next posts link in WordPress
- Query against multiple locations within single custom post type post
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- How to create page with post content in it?
- Blogposting Schema & Structured Data without plugin
- Order posts inside bootstrap card columns
- long-title posts do not want published
- Automatically select template based on query string for New Posts
- How to remove a post from results by ID after query?
- Using a meta_value or postdate to to query and orderby
- Exclude posts in home slider from sections
- Display Updated Date Instead of Published Date
- Order 2 meta_queries differently in WP_Query?
- Is there a way to save different data when USER interacts with the same POST?
- Mix post date with post meta value using WP_Query
- How to use two query result together in one loop
- Add postmeta to all blog posts
- show loop id post , only first id can read
- When working with a post, almost all wp_postmeta are deleted
- WP_Query that targets all categories
- Counting Posts by Category
- Fill the exclude array() in get_posts()
- show image gallery in archives or category page
- Page with Category Returning 1
- The first post appears twice