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.
Compatibility
- WordPress
- since 4.9.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
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.
Where this hook fires · 1
wp-includes/class-wp-network.php:234WP_Network::get_main_site_id()
Source code
* * @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 ) {Changelog
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 7.1.0 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.