ramirulo (February 25th, 2020)
/**
* Updates post meta with increased page views count
*/
function tr_process_page_view(){
$post = get_queried_object();
if ( ! $post ) {
return;
}
$views = get_post_meta( $post->ID, 'view_count', true );
$shouldLogView = apply_filters( 'tr_log_page_view', true );
if ( $shouldLogView ) {
update_post_meta( $post->ID, 'view_count', $views + 1 ); /*This is line 27*/
}
}
/**
* Stops page views from counting more than once per an ip address
*/
ramirulo (February 25th, 2020)
ramirulo (February 26th, 2020)
ramirulo (February 28th, 2020)
There are currently 1 users browsing this thread. (0 members and 1 guests)