Select only post id and meta value with WP_Query
Question
I’m developing a simple rank plugin, which allows visitors to like the posts and also shows the total like scores for each tag in the plugin’s admin page. I need both post IDs (in order to reach the tag data of them) and like values.
This is my query at the moment:
$args = array(
'meta_key' => '_Like',
'orderby' => 'meta_value',
);
$query = new WP_Query($args);
But this query returns the complete post object, it’s not efficient for the memory. I only need _Like
value and the post_id
. Is there a better query for this ?
0
posts, wp-query
8 months
0 Answers
82 views
0
Leave an answer
You must login or register to add a new answer .