Make WordPress Core

Changeset 62930


Ignore:
Timestamp:
07/29/2026 07:48:11 PM (2 weeks ago)
Author:
westonruter
Message:

Networks and Sites: Pass the missing $site_id to bulk actions.

The handle_network_bulk_actions-{$screen} filter has documented a $site_id parameter since 4.7.0, when r38647 and r38957 introduced it. However, this parameter was not passed to all instances of the filter being applied, resulting in a possible fatal error if a callback is expecting it.

The Network Themes and Network Users screens act on the network as a whole rather than on a single site, so there is no site ID to supply and 0 is passed. This matches wp-admin/network/sites.php, where the value already falls back to 0 when the request carries no site.

These call sites were surfaced by the PHPStan extensions under development for this ticket, which are committed separately.

Developed as subset of https://github.com/WordPress/wordpress-develop/pull/12022.
Follow-up to r38647, r38957.

See #65376, #16031.

Location:
trunk/src/wp-admin/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/themes.php

    r61444 r62930  
    294294
    295295                        /** This action is documented in wp-admin/network/site-themes.php */
    296                         $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $themes ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     296                        $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $themes, 0 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    297297
    298298                        wp_safe_redirect( $referer );
  • trunk/src/wp-admin/network/users.php

    r62688 r62930  
    159159
    160160                                        /** This action is documented in wp-admin/network/site-themes.php */
    161                                         $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     161                                        $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids, 0 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    162162
    163163                                        wp_safe_redirect( $sendback );
Note: See TracChangeset for help on using the changeset viewer.