pre_wp_load_alloptions
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.
Использование
add_filter( 'pre_wp_load_alloptions', 'wp_kama_pre_wp_load_alloptions_filter', 10, 2 );
/**
* Function for `pre_wp_load_alloptions` filter-hook.
*
* @param array|null $alloptions An array of alloptions.
* @param bool $force_cache Whether to force an update of the local cache from the persistent cache.
*
* @return array|null
*/
function wp_kama_pre_wp_load_alloptions_filter( $alloptions, $force_cache ){
// filter...
return $alloptions;
}
- $alloptions(массив|null)
- An array of alloptions.
По умолчанию: null - $force_cache(true|false)
- Whether to force an update of the local cache from the persistent cache.
По умолчанию: false
Список изменений
| С версии 6.2.0 | Введена. |
Где вызывается хук
wp-includes/option.php 615
$alloptions = apply_filters( 'pre_wp_load_alloptions', null, $force_cache );