Get posts after calculating meta key
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 … Read more