[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
Tue Jun 15 18:40:04 UTC 2021


#44412: 'pre_cache_alloptions' filter in wp_load_alloptions() in option.php cannot
be hooked
----------------------------+-----------------------------
 Reporter:  redsnowcompany  |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Future Release
Component:  Cache API       |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  needs-docs      |     Focuses:
----------------------------+-----------------------------
Changes (by azaozz):

 * keywords:   => needs-docs
 * type:  defect (bug) => enhancement
 * severity:  major => normal
 * milestone:  Awaiting Review => Future Release


Comment:

 Thanks @redsnowcompany for opening this ticket. You're right, the
 `pre_cache_alloptions` filter is unusable from plugins and themes. Seems
 it can only be used from cli or from one of the caching "drop-in" plugins.
 Don't think that can be changed.

 Best would be to update the docs. A similar "too early" filter is
 `enable_loading_advanced_cache_dropin`, see
 https://developer.wordpress.org/reference/hooks/enable_loading_advanced_cache_dropin/.

 > 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.

 That's usually caused by old or buggy plugin(s). Best would be to fix or
 replace the plugin. Having a huge options table is no good :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44412#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list