WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] add_action question (2 posts)

  1. huntz
    Member
    Posted 5 years ago #

    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

  2. studiocodes
    Member
    Posted 5 years ago #

    Yes, try changing that plugin line to something like:

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.