Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address deprecation warning for wpmu_new_blog #156

Merged
merged 4 commits into from
Oct 10, 2022

Conversation

kadamwhite
Copy link
Contributor

Description of the Change

Adapt plugin to use wp_initialize_site instead of deprecated wpmu_new_blog hook when using a recent WordPress version.

wpmu_new_blog has been deprecated since 5.1.0, in favor of wp_initialize_site which receives a full WP_Site instance instead of the Blog ID.

This approach of checking the version matches how wordpress-seo handles this, but depending on this plugin's support matrix, the function could alternatively be switched over to use only the new hook.

How to test the Change

I have not exhaustively tested this locally. To test, create a new network site and verify whether the simple_local_avatars option has the expected defaults.

Changelog Entry

Changed - Set plugin defaults on wp_initialize_site instead of deprecated action wpmu_new_blog.

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

wpmu_new_blog has been deprecated since 5.1.0, in favor of wp_initialize_site which receives a full WP_Site instance instead of the Blog ID.

This approach of checking the version matches how wordpress-seo handles this:
https://github.com/Yoast/wordpress-seo/blob/9946d8cdc97857fa8311be2ab0b11cce539beb98/wp-seo-main.php#L442-L449
but depending on this plugin's support matrix, the function could alternatively be switched over to use only the new hook.
@jeffpaul jeffpaul added this to the 2.7.0 milestone Oct 4, 2022
includes/class-simple-local-avatars.php Outdated Show resolved Hide resolved
includes/class-simple-local-avatars.php Outdated Show resolved Hide resolved
includes/class-simple-local-avatars.php Outdated Show resolved Hide resolved
@faisal-alvi
Copy link
Member

@kadamwhite thanks for your work! I have made minor spacing fixes and a fatal error of a missing bracket. Then tested and it's working fine. 🎉

The object result while testing:

image

@faisal-alvi faisal-alvi merged commit baa6451 into 10up:develop Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants