Make WordPress Core

Opened 3 years ago

Last modified 7 months ago

#44412 new defect (bug)

'pre_cache_alloptions' filter in wp_load_alloptions() in option.php cannot be hooked

Reported by: redsnowcompany Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version:
Component: Cache API Keywords:
Focuses: Cc:


Whenever wordpress loads, it fetches all options with the wp_load_alloptions() function in the option.php file. There is a filter in the function before sending it to the cache: {{{#!php
$alloptions = apply_filters( 'pre_cache_alloptions', $alloptions );

However, there is no way to hook into this filter in the theme or plugin because the theme or plugin are loaded afterwards.

So the full array is always send to the cache.

We were having trouble with a site that loaded all of the options with autoload 'yes' and it crashed with a memory limit exhausted error because there were too many options.

An action needs to be added to hook into this filter or move the calling of this function some steps further after a theme or plugin is loaded.

Change History (1)

#1 @sabernhardt
7 months ago

  • Component changed from General to Cache API
Note: See TracTickets for help on using tickets.