Skip to content

Commit

Permalink
Fix the small errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Antontokarchuk0302 committed Feb 23, 2020
1 parent a5908f0 commit eada825
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wp-post-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ public function counter(){

else {
$meta_key = 'entry_views';
$view_post_meta = get_post_meta(get_the_ID(), $meta_key, true);
$view_post_meta = get_post_meta(get_the_ID(), $meta_key, true);
if( ! is_int($view_post_meta) ){
$view_post_meta = 0;
}
$new_viewed_count = $view_post_meta + 1;
update_post_meta(get_the_ID(), $meta_key, $new_viewed_count);
$ip_arr[] = $this->get_ip_address();
Expand Down

0 comments on commit eada825

Please sign in to comment.