WordPress 7.1 Compatibility Updates - #428
Conversation
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
|
@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
left a comment
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
This will ensure backward compatibility for third party code calling the function.
| public static function set_defaults( $new_site ) { | |
| public static function set_defaults( $new_site ) { | |
| $new_site = get_site( $new_site ); | |
| if ( ! $new_site ) { | |
| return; | |
| } |
There was a problem hiding this comment.
Thanks, @peterwilsoncc! This has been added!
| * Set RSA defaults for a new site. | ||
| * | ||
| * @param int $blog_id New site/blog ID. | ||
| * @param WP_Site $new_site New site object. |
There was a problem hiding this comment.
| * @param WP_Site $new_site New site object. | |
| * @param WP_Site|int $new_site New site object or ID. |
There was a problem hiding this comment.
@peterwilsoncc This has been added. Thanks!
peterwilsoncc
left a comment
There was a problem hiding this comment.
This looks good to me and is testing well, thank you!
Description of the Change
Replace the deprecated
wpmu_new_blogaction withwp_initialize_sitewhen copying Restricted Site Access network defaults onto a newly created site.wpmu_new_bloghas been deprecated since WordPress 5.1 and now only fires throughdo_action_deprecated(). This plugin requires WordPress 6.6, so a version fallback is not needed. Core still initializes the site at priority 10 onwp_initialize_sitefirst; RSA then copies networkrsa_optionsandblog_publiconto the new site, same as before.Restricted_Site_Access::set_defaults()now receives a WP_Site object and uses$new_site->idinstead of a numeric blog ID. Direct callers that still pass an integer (or the old six-argumentwpmu_new_blogsignature) will need to pass aWP_Siteinstance.Unit tests were updated to assert the new hook and to pass
WP_Siteobjects fromget_sites().Benefits: Removes
WP_DEBUGdeprecation notices on new site creation and uses the current Multisite site-initialization API.Closes #427
How to test the Change
blog_public/ restrict access) and leave network mode not onenforce.rsa_optionsandblog_publicmatch the network defaults.WP_DEBUGandWP_DEBUG_LOGenabled, create a site and confirm this plugin does not log awpmu_new_blogdeprecation notice.Changelog Entry
Credits
Props @phpbits
Checklist: