WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] functions.php gets called multiple times on dashboard (2 posts)

  1. kjmeath
    Member
    Posted 3 years ago #

    I noticed that a theme's functions.php is called numerous times on the dashboard page.

    It seems that its called on initialization, and once for each of the following dashboard widgets: Quick Press, Incoming Links, WordPress Blog, Plugins and Other WordPress News.

    You can test this yourself by echoing out a simple statement at the top of functions.php.

    My question is why does this happen and is it necessary?

    For example, if I am including a class in my functions.php, and I instantiate that class, this ends up happening numerous times, even though I only want it to happen once.

    Some insight on this would be nice!

    Cheers
    KJ

  2. kjmeath
    Member
    Posted 3 years ago #

    irc member nkuttler: so the ajax calls wp, which creates a new wp instance, which loads the theme, which does the output. i guess it should be possible for you to detect if it is an ajax call.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags