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?
- Show posts assigned to multiple categories in current category page
- The problem with WordPress Importer
- Future post ID not showing
- Custom WordPress Theme: Publish Date and Display Date for posts right beside each other
- How can I show many posts an author has per week?
- How do I use WP_Query to get a range of posts with custom fields that have numbers with letters in them?
- Ajax load more button in Recent posts widget
- WP_Query with ajax handler returns the same posts
- WP_Query orderby not working with meta_value_num and menu_order
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Custom WP_Query with complex ‘post_status’ argument
- How can I sort posts by the date and a custom meta field?
- is there a way to show the the post title after the image?
- recent posts for different categories
- Why aren’t my posts/pages showing up in my WordPress Theme?
- Search by post title and content in wp_query without order
- Hiding Draft Post In Admin
- Exclude category from
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- Blog post per page setting conflicting with custom WP_Query?
- Change post order random through out the entire WordPress
- How to insert 2 args into 1 Wp_Query for a slideshow
- How to exclude latest x posts from a paginated query?
- Setup a custom dynamic post
- Anyway to grab author name and featured image in an embeded in inital array of posts outside of loop?
- How to verify wp user password by sql query in wp? [closed]
- Removing noindex posts from wp_query
- How to display the link (title) and thumbnail post?
- Underscores Theme Unit Testing – Catching Untitled Posts
- get_the_excerpt() is not working as expected – returns wrong text
- WP Query – Posts Per Page not working in combination with category__in
- Ajaxify This Code
- How to use format post in a pertinent way
- How to filter my search in post if contains a word in title, content or excerpt?
- How to return another post than requested
- Pausing and Resuming WP_Query results
- How to do set post permalinks using 6 digit random unique function?
- Select only post id and meta value with WP_Query
- Lost draft under all posts and drafts
- Get user categories with most posts in it
- Unable to restore from backup – how to obtain old blog posts?
- Random ajax load only works with posts_per_page set to -1
- How to : pagination in 3 different custom loops on the same page
- How to change the color theme per post?
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- Exclude the first ‘n’ number of posts of a tag from home page?
- Query posts and return XML
- how to change the number of posts returned in a specific loop without making it global?
- Query Posts With Over 1000 Views
- Disable sticky option for specific categories
- posts_per_page option limits the number of Gallery items
- List authors with the last post title and order by last post date
- How to order posts by meta_value and title
- wp_query random post
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Adding a blog archive with pagination using WP_Query
- How to get Tags with specific post id
- Redirect to another page using contact form 7? [closed]
- how can i change WP main archives loop to sort by name or title
- How to create a template for Pages?
- Remove Content after
- How do I do a page break?
- Using wp_list_pages() after calling query_posts()
- how to get post order by post id wp_query?
- Shortcodes on my website stops working after theme update [closed]
- Possible to alternate between two loops
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- How to display all posts divided/ordered by post date? [closed]
- Why Query is returning empty array?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- WordPress website loads more posts than expected
- Why are my paginated posts always returning the same results?
- Ignore latest two posts
- Is it possible to use WP_Query to only pull posts with attachments?
- What does WordPress do if I save a post without content/title? [duplicate]
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- How to add a class to edit_post_link?