I'm trying to show the most popular (recent) posts on my blog. I have made a special formula for this. I am querying for these posts like so:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'meta_key' => '_post_popularity',
'meta_query' => array(
array(
'key' => 'post_date',
'value' => date("Y-m-d H:i:s", strtotime('-30 days')),
'compare' => '>',
'type' => 'DATETIME'
)
),
'orderby' => 'meta_value_num',
'order' => 'DSC');
query_posts( $args );
I don't think that is correct however, as WP is interpreting "key" as a meta_key, whereas I want to use the Publish Date in the post table.
Taking out "meta_query" works fine, I can see the most popular posts, but it doesn't restrict it to the most recent ones. I check the documentation but post_date is not mentioned as a way to "filter", only sort.
Is this possible? Thanks.