postviews_id is an Undefined Index
-
The following error happens when the plugin is activated:
Notice: Undefined index: postviews_id in /mounted-storage/path-to-my-wp/wp-content/plugins/wp-postviews/wp-postviews.php on line 648
I tried to fix it but I made it even worst, so I decided to raise this topic. The following piece of code is where the error happens, in acord of the error above:
### Function: Increment Post Views increment_views(); function increment_views() { global $wpdb; $post_id = intval($_GET['postviews_id']); if($post_id > 0 && defined('WP_CACHE') && WP_CACHE) { $post_views = get_post_custom($post_id); $post_views = intval($post_views['views'][0]); if(!update_post_meta($post_id, 'views', ($post_views+1))) { add_post_meta($post_id, 'views', 1, true); } } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘postviews_id is an Undefined Index’ is closed to new replies.