[wp-trac] [WordPress Trac] #44412: 'pre_cache_alloptions' filter in wp_load_alloptions() in option.php cannot be hooked
WordPress Trac
noreply at wordpress.org
Wed Jun 20 12:47:33 UTC 2018
#44412: 'pre_cache_alloptions' filter in wp_load_alloptions() in option.php cannot
be hooked
----------------------------+-----------------------------
Reporter: redsnowcompany | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: major | Keywords:
Focuses: |
----------------------------+-----------------------------
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
<?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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44412>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list