i want get the last 5 popular posts in sidebar in wordpress.
but dont work. Why?

$popularpost = new WP_Query( array(
            'meta_key' => 'post_views_count',
            'orderby' => 'meta_value_num',
            'posts_per_page' => 5
        ) );


        if ($popularpost->have_posts()) {
            while ( $popularpost->have_posts() ) : $popularpost->the_post() ?>

            <article class="post-side">
                <span><?php the_date(); ?></span>
                <a href="<?php the_permalink(); ?>" target="_parent"><h5><?php the_title(); ?></h5></a>
            </article>

        <?php endwhile; } ?>

Read more here: Get popular posts in wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: