Options, Meta APIs: Add a filter to allow the shortcut return to `wp_load_alloptions` function.
Add a new filter `pre_wp_load_alloptions` in the `wp_load_alloptions` function to short circuit the return value. Props pbearne, spacedmonkey, joyously, SergeyBiryukov, mukesh27, costdev. Fixes #56045. Built from https://develop.svn.wordpress.org/trunk@55256 git-svn-id: http://core.svn.wordpress.org/trunk@54789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bd2eae6719
commit
65c71d1db4
|
@ -301,6 +301,22 @@ function form_option( $option ) {
|
||||||
function wp_load_alloptions( $force_cache = false ) {
|
function wp_load_alloptions( $force_cache = false ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the array of alloptions before it is populated.
|
||||||
|
*
|
||||||
|
* Returning an array from the filter will effectively short circuit
|
||||||
|
* wp_load_alloptions(), returning that value instead.
|
||||||
|
*
|
||||||
|
* @since 6.2.0
|
||||||
|
*
|
||||||
|
* @param array|null $alloptions An array of alloptions. Default null.
|
||||||
|
* @param bool $force_cache Whether to force an update of the local cache from the persistent cache. Default false.
|
||||||
|
*/
|
||||||
|
$alloptions = apply_filters( 'pre_wp_load_alloptions', null, $force_cache );
|
||||||
|
if ( is_array( $alloptions ) ) {
|
||||||
|
return $alloptions;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! wp_installing() || ! is_multisite() ) {
|
if ( ! wp_installing() || ! is_multisite() ) {
|
||||||
$alloptions = wp_cache_get( 'alloptions', 'options', $force_cache );
|
$alloptions = wp_cache_get( 'alloptions', 'options', $force_cache );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-alpha-55255';
|
$wp_version = '6.2-alpha-55256';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue