Filter hook 'pre_wp_load_alloptions'

in WP Core File wp-includes/option.php at line 615

View Source

pre_wp_load_alloptions

Filter Hook
Description
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.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Filter
Line Number 615

Hook Parameters

Type Name Description
array|null $alloptions An array of alloptions. Default null.
bool $force_cache Whether to force an update of the local cache from the persistent cache. Default false.

Usage Examples

Basic Usage
<?php
// Hook into pre_wp_load_alloptions
add_filter('pre_wp_load_alloptions', 'my_custom_filter', 10, 2);

function my_custom_filter($alloptions, $force_cache) {
    // Your custom filtering logic here
    return $alloptions;
}

Source Code Context

wp-includes/option.php:615 - How this hook is used in WordPress core
<?php
 610  	 * @since 6.2.0
 611  	 *
 612  	 * @param array|null $alloptions  An array of alloptions. Default null.
 613  	 * @param bool       $force_cache Whether to force an update of the local cache from the persistent cache. Default false.
 614  	 */
 615  	$alloptions = apply_filters( 'pre_wp_load_alloptions', null, $force_cache );
 616  	if ( is_array( $alloptions ) ) {
 617  		return $alloptions;
 618  	}
 619  
 620  	if ( ! wp_installing() || ! is_multisite() ) {

PHP Documentation

<?php
/**
	 * 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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.