apply_filters( 'pre_get_main_site_id', int|null $main_site_id, WP_Network $network )
- Since
- 4.9.0
Filters the main site ID.
Description
Returning a positive integer will effectively short-circuit the function.
Parameters
$main_site_idint|null- If a positive integer is returned, it is interpreted as the main site ID.
$networkWP_Network- The network object for which the main site was detected.
Fired at · 1
wp-includes/class-wp-network.php:230WP_Network::get_main_site_id()
Source
* * @since 4.9.0 * * @param int|null $main_site_id If a positive integer is returned, it is interpreted as the main site ID. * @param WP_Network $network The network object for which the main site was detected. */ $main_site_id = (int) apply_filters( 'pre_get_main_site_id', null, $this ); if ( 0 < $main_site_id ) { return $main_site_id; } if ( 0 < (int) $this->blog_id ) {History
Introduced in 4.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.