Skip to content
Diamond Sierra

PB-2601: Slow function

Paul Bunyan code PB-2601 (Warning): Slow function. What it means and what to do.

Updated · By Diamond Sierra

On this page

What it means

One function attached to a hook took longer than the slow-function threshold. The time includes whatever that function called.

What to do

The message gives the function, plugin, file and line. "Inside" shows how the time splits between queries, outside calls, email and plain PHP.

Common causes

  • A function doing database work in a loop, or one slow query (see its "Inside" line).
  • A call to another server inside the function (PB-2401).
  • Loading and parsing large files or settings on every request.
  • Plugins that do setup work on init or wp_loaded for every page, even pages that don't use them.

How to find and fix it

  1. The message gives the function, plugin, file and line. "Inside" splits its time into queries, outside calls, email and plain PHP.
  2. Mostly queries: look at the Database screen for that function. Mostly outside calls: cache the answer or move it to the background. Mostly plain PHP: it is processor work (PB-2104).
  3. If the function runs on every page but is only needed on a few, ask the plugin's author whether it can load only where needed.
  4. Compare before and after an update with Compare, using the marker Paul Bunyan saves on each plugin update.

Details

CodeSeverityGroup
PB-2601WarningCode