Support » Fixing WordPress » add_action question

  • Resolved huntz

    (@huntz)


    Hey guys,

    I’ve got add_action(‘wp_head’, ‘myfunction()’); on the bottom of one of my plugin pages and so myfunction() runs on every page. I want to limit this to single.php pages, does anyone know how?

    Thanks

Viewing 1 replies (of 1 total)
  • Yes, try changing that plugin line to something like:

    if (is_single())
    {
    	add_action('wp_head', 'myfunction()');
    }

Viewing 1 replies (of 1 total)
  • The topic ‘add_action question’ is closed to new replies.