Support » Themes and Templates » Function called twice on single-.php

  • Hello,

    1. I have created a custom post type and corresponding custom single page.
    2. So single-music.php is a copy of single.php
    3. I have a hyper-link on single-music.php called I AGREE. The link points to the same permalink of the post music with the ?action=agree appended in the end.
    4. The idea is when the user clicks the link, I will circle back to the same post but before doing that I will simple update some data on a table. So the first lines in single-music.php are
    if($_GET[‘action’] == ‘agree’){ update table by incrementing a counter against user).

    5. All this works fine, just that the table gets incremented 2 times, as if the user has agreed to 2 items instead of one.

    6. Point to Note:

    • This issue is not local to FireFox, but observed in Safari also.
    • My permalink is set to Post name ( if that matters )

    7. I have tried other solutions like
    remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 ); but that does not work either. May be I am not removing the action properly.

    8. Any suggestions will help me.

  • The topic ‘Function called twice on single-.php’ is closed to new replies.