WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] add_action question

[Resolved] add_action question

  • 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)
  • studiocodes
    Member

    @studiocodes

    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 ‘[Resolved] add_action question’ is closed to new replies.