Assuming meta_count
is another column in your postmeta
table below query should get you the posts based on meta_value/meta_count
calculation.
$postids=$wpdb->get_col( $wpdb->prepare(
"SELECT post_id
FROM $wpdb->postmeta
ORDER BY (meta_value/meta_count)
LIMIT 10
"
) );
The result $postids
would be an array. You will have to declare $wpdb
as a global variable before you use this query.
Related Posts:
- How to know if get_posts() failed?
- How do I change the gallery that is inserted in the post?
- Convert a complex webpage into WP theme
- Why won’t my taxonomy query show up?
- Why orderby=”date” does not support manually changed posts?
- How to show single post page as home page
- Blog page not working
- Highlight static blog page link in header
- Block editors annoying warnings
- how to handle the loop using filling bootstrap grid structure?
- How do I allow certain users to make a certain type of post?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Displaying a specific sub-category’s posts from wp_query
- How to show the posts list into a static page? Problems to use the loop into a static page
- wordpress taxonomy results
- Wp_query WooCommerce products
- Is there a block to print post link standalone in a block theme?
- How to get Images included in Post
- Accessing the post content with WP_Query
- Post & edit a post from front end along with upload, dropdown, and other inputs
- Get only modified posts
- How to output comments number of a post per day?
- Displaying Page Title on index.php
- How to enqueue scripts depending on post formats?
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- If specific user role then sticky post
- Display posts with comments closed, with pagination?
- I want to query posts in monthly basis
- Custom WP_QUERY $args
- Improving WP_Query for performance when random posts are ordered
- Posts vs. Pages
- Limiting the number of posts in WP_Query leads to unexpected result
- What is the standard featured image size?
- How to insert 2 args into 1 Wp_Query for a slideshow
- Underscores Theme Unit Testing – Catching Untitled Posts
- WP Query – Posts Per Page not working in combination with category__in
- How to do set post permalinks using 6 digit random unique function?
- Unable to restore from backup – how to obtain old blog posts?
- posts_per_page option limits the number of Gallery items
- Why Query is returning empty array?
- meta_value timestamp older than now
- How to add a class to edit_post_link?
- Get posts with multiple categories
- Do not show children of a category
- Query for first 3 posts to change the look and feel
- WP_Query with custom post type ID
- Getting blog pagination to work on page set as front page
- How to identify and hide/remove an element from a WordPress page [closed]
- search blog posts by author first name and or last name
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- How to give classname to post if post has no content?
- Images showing up in Post Editor, but not in Published Post
- Custom wp-query in wordpress rest api
- posts_per_page returning only one post
- Getting Whitescreen when publishing a post [closed]
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to display post list in a table layout (multiple queries in single loop)
- WP_Query custom field pass the post id
- How do I link a Post Type to a Template in Masterplan?
- Change the background of each post according to the category
- Current and next month posts
- Get latest author posts inside the loop
- Same post appears in related Posts?
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- Page of posts made to look like homepage
- Permanently deleted posts still exist
- WP_Query outputs wrong post in custom post type
- how to show comments only author which send own posts in wordpress
- Group first, 2nd, 3rd, etc posts by category terms
- Related post not showing table of content
- How to sort WP_Post Object array by object field in php?
- Order by meta_key field in WordPress not meta_value field value
- How to create page with post content in it?
- How to remove a post from results by ID after query?
- How to prevent clicking on posts
- Hiding title of selected post without plugins
- Override wp_link_pages pagebreak with filter
- WP_Query extended with AJAX
- Is it possible to query a category with specified posts?
- Trim excerpt to first paragraph
- Blog only showing one post even though more published
- WordPress loop uses unmodified posts array, why?
- Sort / Filter Queries
- Query to get data of a post, if in category?
- Order posts by custom field
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- Order posts by separate menu order for different sub-categories
- Adding a category at even positions on main loop with modified pagination
- Why I getting only 1 post?
- What is wrong with this wp_query?
- How do I get the WordPress post to display the content instead of an image?
- Automatically delete default posts and pages on theme install?
- Extra Theme – Fit image inside of Featured Post Slider
- Exclude sub sub categories from displaying in the archive page
- Change from all posts to specific categories post on main page?
- How to manage wordpress knowledge base/wiki/posts collections