Skip to content

WordPress 7.1 Compatibility Updates - #428

Merged
peterwilsoncc merged 6 commits into
developfrom
feature/wp-compat-check-7.1
Aug 24, 2026
Merged

WordPress 7.1 Compatibility Updates#428
peterwilsoncc merged 6 commits into
developfrom
feature/wp-compat-check-7.1

Conversation

@phpbits

@phpbits phpbits commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description of the Change

Replace the deprecated wpmu_new_blog action with wp_initialize_site when copying Restricted Site Access network defaults onto a newly created site.

wpmu_new_blog has been deprecated since WordPress 5.1 and now only fires through do_action_deprecated(). This plugin requires WordPress 6.6, so a version fallback is not needed. Core still initializes the site at priority 10 on wp_initialize_site first; RSA then copies network rsa_options and blog_public onto the new site, same as before.

Restricted_Site_Access::set_defaults() now receives a WP_Site object and uses $new_site->id instead of a numeric blog ID. Direct callers that still pass an integer (or the old six-argument wpmu_new_blog signature) will need to pass a WP_Site instance.

Unit tests were updated to assert the new hook and to pass WP_Site objects from get_sites().

Benefits: Removes WP_DEBUG deprecation notices on new site creation and uses the current Multisite site-initialization API.

Closes #427

How to test the Change

  1. On a multisite install with Restricted Site Access network-activated, set network RSA settings (including blog_public / restrict access) and leave network mode not on enforce.
  2. Create a new site (Network Admin → Sites → Add New).
  3. Switch to that site and confirm rsa_options and blog_public match the network defaults.
  4. Set network mode to enforce, create another new site, and confirm site-level RSA options are not written (enforced network settings still apply).
  5. With WP_DEBUG and WP_DEBUG_LOG enabled, create a site and confirm this plugin does not log a wpmu_new_blog deprecation notice.
  6. Run the PHPUnit suite, including the multisite tests (test-actions.php and tests/php/multisite/test-settings.php).

Changelog Entry

Deprecated - Soon-to-be removed feature

Credits

Props @phpbits

Checklist:

@github-actions github-actions Bot added this to the 7.7.0 milestone Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@phpbits
phpbits marked this pull request as ready for review August 18, 2026 12:46
@github-actions github-actions Bot added the needs:code-review This requires code review. label Aug 18, 2026
@phpbits
phpbits marked this pull request as draft August 18, 2026 13:42
@github-actions github-actions Bot removed the needs:code-review This requires code review. label Aug 18, 2026
@phpbits
phpbits marked this pull request as ready for review August 18, 2026 17:08
@github-actions github-actions Bot added the needs:code-review This requires code review. label Aug 18, 2026
@phpbits

phpbits commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@jeffpaul This is now ready for review. I've updated the minimum version to 6.9 and I've tested this on the new 7.1 RC. There is one deprecated hook that I've updated, more information in the PR description. Thanks!

@peterwilsoncc peterwilsoncc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a note inline re: maintaining backward compatibility with the set_defaults() method.

* @param WP_Site $new_site New site object.
*/
public static function set_defaults( $blog_id ) {
public static function set_defaults( $new_site ) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will ensure backward compatibility for third party code calling the function.

Suggested change
public static function set_defaults( $new_site ) {
public static function set_defaults( $new_site ) {
$new_site = get_site( $new_site );
if ( ! $new_site ) {
return;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @peterwilsoncc! This has been added!

Comment thread restricted_site_access.php Outdated
* Set RSA defaults for a new site.
*
* @param int $blog_id New site/blog ID.
* @param WP_Site $new_site New site object.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param WP_Site $new_site New site object.
* @param WP_Site|int $new_site New site object or ID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterwilsoncc This has been added. Thanks!

@phpbits
phpbits requested a review from peterwilsoncc August 21, 2026 15:29

@peterwilsoncc peterwilsoncc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me and is testing well, thank you!

@peterwilsoncc
peterwilsoncc merged commit d4b08f6 into develop Aug 24, 2026
25 of 27 checks passed
@peterwilsoncc
peterwilsoncc deleted the feature/wp-compat-check-7.1 branch August 24, 2026 01:03
@peterwilsoncc peterwilsoncc mentioned this pull request Aug 25, 2026
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:code-review This requires code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The plugin hasn't been tested with the latest version of WordPress

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo