• Resolved mindspins

    (@mindspins)


    I use the following code in my header.php to keep track of the posts visited by users, but somehow Firefox stores two ID’s on one page visit. The second ID is from the next page published. The last post published is the only page that gets me one ID, since there is no next post.
    Do you know what could be wrong?! I really appreciate all the help I can get, cause it keeps me puzzled for days now.

    <?php
    global $wp_query;
    $post_id = $wp_query->post->ID;
    $cookietime = time()+3600*24*365;
    $lt = '|';
    if (isset($_COOKIE['tst'])) {
    	$viewedstring = $_COOKIE['tst'];
    	$viewedstring .= $post_id.$lt;
    	setcookie('tst', $viewedstring, $cookietime, '/', '.domain.com');
    }else{
    	$viewedstring = $post_id.$lt;
    	setcookie('tst', $viewedstring, $cookietime, '/', '.domain.com');
    }
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mindspins

    (@mindspins)

    I guess it’s a bug?! No WordPress wizards to help me out here?!

    I’ve just spent a while hunting this down, it’s related to Firefox’s prefetching combined with wordpress’s use of the rel=”next” meta tag.

    To remove these meta tags from your WordPress site, add the following to your theme’s functions.php file:

    For WordPress versions 3.0 and above:
    //remove auto loading rel=next post link in header
    remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’);

    For older WordPress versions:
    //remove auto loading rel=next post link in header
    remove_action(‘wp_head’, ‘adjacent_posts_rel_link’);

    See http://www.ebrueggeman.com/blog/wordpress-relnext-and-firefox-prefetching/

    Thread Starter mindspins

    (@mindspins)

    Mothra,

    I honestly gave up already! You ROCK!

    Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Firefox uses header.php twice?!’ is closed to new replies.