WordPress at Your Fingertips
filter is not described

pre_get_main_site_id filter-hook . WP 4.9.0

Filters the main site ID.

Returning a positive integer will effectively short-circuit the function.


add_filter( 'pre_get_main_site_id', 'filter_function_name_2254', 10, 2 );
function filter_function_name_2254( $main_site_id, $network ){
	// filter...

	return $main_site_id;
If a positive integer is returned, it is interpreted as the main site ID.
The network object for which the main site was detected.


Since 4.9.0 Introduced.

Where the hook is called

wp-includes/class-wp-network.php 229
$main_site_id = (int) apply_filters( 'pre_get_main_site_id', null, $this );

Where in WP core the hook is used WordPress

Usage not found.