0

Im tracking down slowness issues. This line:

do_action( 'init' );

in wp-settings.php takes 4,5 seconds to run alone. Most of plugins are turned off now. Is there a way to run those init() hooks one by one so that I can measure which routine makes this dramatic slowness?

1

When there's an issue such as yours, there is probably 1 function stuck somewhere that delays the loading. You can retrieve a list of all functions attached to a hook this way:

global $wp_filter;
$actions = $wp_filter['init'] ;

Now you can remove the functions from the hook one by one, by using remove_action() and see when the problem goes away. Some of the functions are of core functions of course, and will crash the loading if unhooked.

There's also another reason that terribly slows the loading process. WordPress and some other plugins might some times try to access a remote URL using cURL or other methods. If the remote server is slow or doesn't reply immediately, the performance impact will be drastic. I suggest you try and load your website with no network adapter enabled, if it's a local installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.