WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/30/2017 07:55:09 PM (3 years ago)
Author:
flixos90
Message:

Multisite: Pass network object instead of ID to pre_get_main_site_id.

In the original function introduced in [41380], and subsequently [41861], only the network ID was passed to the new pre_get_main_site_id filter. In order to make give quick access to other network properties, it was decided to pass the whole object instead. The changeset includes an additional test.

Fixes #29684.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-network.php

    r41861 r42043  
    220220         * @since 4.9.0
    221221         *
    222          * @param int|null $main_site_id If a positive integer is returned, it is interpreted as the main site ID.
    223          * @param int $network_id The ID of the network for which the main site was detected.
     222         * @param int|null   $main_site_id If a positive integer is returned, it is interpreted as the main site ID.
     223         * @param WP_Network $network      The network object for which the main site was detected.
    224224         */
    225         $main_site_id = (int) apply_filters( 'pre_get_main_site_id', null, $this->id );
     225        $main_site_id = (int) apply_filters( 'pre_get_main_site_id', null, $this );
    226226        if ( 0 < $main_site_id ) {
    227227            return $main_site_id;
Note: See TracChangeset for help on using the changeset viewer.