Popular posts without plugin
Question
All the codes i got online are not working, please i need a working popular post codes…
I dont want to use plugins
I already tried this
function wpb_set_post_views($postID) {
$count_key = 'wpb_post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
//To keep the count accurate, lets get rid of prefetching
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
0
post-meta, posts
4 years
2020-02-25T08:38:37-05:00
2020-02-25T08:38:37-05:00 0 Answers
84 views
0
Leave an answer