Filter hook 'pre_wp_is_site_initialized'

in WP Core File wp-includes/ms-site.php at line 926

View Source

pre_wp_is_site_initialized

Filter Hook
Description
Filters the check for whether a site is initialized before the database is accessed. Returning a non-null value will effectively short-circuit the function, returning that value instead.

Hook Information

File Location wp-includes/ms-site.php View on GitHub
Hook Type Filter
Line Number 926

Hook Parameters

Type Name Description
bool|null $pre The value to return instead. Default null to continue with the check.
int $site_id The site ID that is being checked.

Usage Examples

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

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

Source Code Context

wp-includes/ms-site.php:926 - How this hook is used in WordPress core
<?php
 921  	 *
 922  	 * @param bool|null $pre     The value to return instead. Default null
 923  	 *                           to continue with the check.
 924  	 * @param int       $site_id The site ID that is being checked.
 925  	 */
 926  	$pre = apply_filters( 'pre_wp_is_site_initialized', null, $site_id );
 927  	if ( null !== $pre ) {
 928  		return (bool) $pre;
 929  	}
 930  
 931  	$switch = false;

PHP Documentation

<?php
/**
	 * Filters the check for whether a site is initialized before the database is accessed.
	 *
	 * Returning a non-null value will effectively short-circuit the function, returning
	 * that value instead.
	 *
	 * @since 5.1.0
	 *
	 * @param bool|null $pre     The value to return instead. Default null
	 *                           to continue with the check.
	 * @param int       $site_id The site ID that is being checked.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/ms-site.php
Related Hooks

Related hooks will be displayed here in future updates.