Support » Plugin: Post Views Counter » Where is stored total views

  • I need to make a sorting of posts by a custom_post_meta and post_views.

    – i cannot find total number of views in post_meta for each post, where is stored and how i could make a sorting by a meta field and post views?

    This works, but i need to sort by post meta too

    
      $args = array(
    	'post_type' 		=> 'post',
    	'post_status' 		=> array('publish'),
    	'posts_per_page'	=> $posts_per_page,
    	'offset'		=> $offset,
    	'paged' 		=> $paged,
    	'orderby' 		=> 'post_views',
    	'order' 		=> 'DESC',
        );
    
      $query = new WP_Query( $args ); 

    Something like:
    https://wordpress.stackexchange.com/questions/75079/nested-meta-query-with-multiple-relation-keys

    • This topic was modified 2 years, 2 months ago by AndreiD.
    • This topic was modified 2 years, 2 months ago by AndreiD.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author dFactory

    (@dfactory)

    You mean order by post meta when the views count is identical for each post?

    It would hardly ever happen I guess. But PVC does not support that.

    We’re not using post meta to store views for performance (and other) reasons. But we extended the native WP_Query in order you can perform (almost) any query you want without messing with custom wpdb calls.

    • This reply was modified 2 years, 2 months ago by dFactory.

    No, i mean total number of views for a post, where is stored, in which post meta or where in the database?

    I can make a code to update daily a custom post meta with total views, but i dont know where is stored this number – total views for a post.

    Plugin Author dFactory

    (@dfactory)

    It’s not stored in post meta, as I said.
    It’s stored in {prefix}post_views table.

    andrewnormore

    (@andrewnormore)

    Why is it not stored as meta data?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Where is stored total views’ is closed to new replies.