WordPress.org

Ready to get started?Download WordPress

Plugin Directory

WP-PostViews

Enables you to display how many times a post/page had been viewed.

How To View Stats With Widgets?

  • Go to WP-Admin -> Appearance -> Widgets
  • The widget name is Views.

How To View Stats (Outside WP Loop)

To Display Least Viewed Posts

  • Use:
<?php if (function_exists('get_least_viewed')): ?>
    <ul>
        <?php get_least_viewed(); ?>
    </ul>
<?php endif; ?>
  • The first value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example array('post', 'page').
  • The second value you pass in is the maximum number of post you want to get.
  • Default: get_least_viewed('both', 10);

To Display Most Viewed Posts

  • Use:
<?php if (function_exists('get_most_viewed')): ?>
    <ul>
        <?php get_most_viewed(); ?>
    </ul>
<?php endif; ?>
  • The first value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example array('post', 'page').
  • The second value you pass in is the maximum number of post you want to get.
  • Default: get_most_viewed('both', 10);

To Display Least Viewed Posts By Tag

  • Use:
<?php if (function_exists('get_least_viewed_tag')): ?>
    <ul>
        <?php get_least_viewed_tag(); ?>
    </ul>
<?php endif; ?>
  • The first value you pass in is the tag id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_least_viewed_tag(1, 'both', 10);

To Display Most Viewed Posts By Tag

  • Use:
<?php if (function_exists('get_most_viewed_tag')): ?>
    <ul>
        <?php get_most_viewed_tag(); ?>
    </ul>
<?php endif; ?>
  • The first value you pass in is the tag id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_most_viewed_tag(1, 'both', 10);

To Display Least Viewed Posts For A Category

  • Use:
<?php if (function_exists('get_least_viewed_category')): ?>
    <ul>
        <?php get_least_viewed_category(); ?>
    </ul>
<?php endif; ?>
  • The first value you pass in is the category id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_least_viewed_category(1, 'both', 10);

To Display Most Viewed Posts For A Category

  • Use:
<?php if (function_exists('get_most_viewed_category')): ?>
    <ul>
        <?php get_most_viewed_category(); ?>
    </ul>
<?php endif; ?>
  • The first value you pass in is the category id.
  • The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example array('post', 'page').
  • The third value you pass in is the maximum number of post you want to get.
  • Default: get_most_viewed_category(1, 'both', 10);

To Sort Most/Least Viewed Posts

  • You can use: <?php query_posts( array( 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) ); ?>
  • Or pass in the variables to the URL: http://yoursite.com/?v_sortby=views&v_orderby=desc
  • You can replace DESC with ASC if you want the least viewed posts.

Requires: 3.0 or higher
Compatible up to: 3.9
Last Updated: 2014-4-17
Downloads: 1,152,692

Ratings

4 stars
4.2 out of 5 stars

Support

23 of 25 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,2,2 100,1,1
100,3,3
0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 60,5,3
0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 33,18,6
0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 78,9,7
0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 69,16,11
0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 57,14,8
0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 67,18,12 0,1,0
0,1,0 0,1,0
33,3,1 0,1,0
100,1,1 0,1,0
75,4,3
100,3,3 59,22,13
60,5,3
100,2,2
40,5,2
100,2,2
88,17,15 100,1,1
50,2,1
69,16,11
100,2,2 50,2,1
100,3,3
83,12,10
100,6,6
100,4,4 100,1,1
71,7,5 100,6,6 0,1,0 50,2,1
100,2,2
100,1,1
100,1,1
100,1,1
33,3,1
100,1,1
100,1,1 100,4,4