Post Views Function No Longer Counting in Single.php
-
In our single.php we have this function:
<?php cherry_setPostViews(get_the_ID()); ?>
This comes from a functions.php template. After setting up W3 Total Cache, our views count is no longer working as it should. Looks like it increases views at 1/100th the rate it should.
How do we get this function to work again?
the full unction in functions.php:
function cherry_setPostViews($postID){
$count_key = ‘post_views_count’;
$count = get_post_meta($postID, $count_key, true);
if($count==”){
$count = 1;
}else{
$count++;
}
update_post_meta($postID, $count_key, $count);
}Cheers!
Ryan
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Post Views Function No Longer Counting in Single.php’ is closed to new replies.