OK, I am trying to develop a Wordpress template that has built in popular post functionality. Everything works, except for one section.
When a single post is viewed, I have the following code in the single.php file.
get_header();
if (have_posts()) :
while (have_posts()) : the_post();
$popular_post_id = $post->ID;
global $wpdb;
$cm_popular_post_insert = $wpdb->query("UPDATE wp_cm_popular_post SET last_viewed=NOW(), page_views = page_views + 1 WHERE postID=$popular_post_id");
The table is being updated as it should, but what the issues is, is the current post being viewed is not the only postID that get updated. It always updates a second postID along side the correct one. I did some debugging. and figure out the problem lies with wp_head(). If I remove that, everything works as expected.
Does anyone have any theiories on why this weird loop issue is occuring?

