Sharing: only hook block to single post template on WP 6.5+#35905
Conversation
Follow-up to #35542 Core recently changed the definition of the filter we're using to automatically add the sharing block to post templates. As a result, our code is not compatible with WordPress 6.4 anymore: ``` PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Automattic\Jetpack\Extensions\Sharing_Button_Block\add_default_services_to_block(), 4 passed in /var/www/html/wp-includes/class-wp-hook.php on line 324 and exactly 5 expected in /usr/local/src/jetpack-monorepo/projects/plugins/jetpack/extensions/blocks/sharing-button/sharing-button.php:254 ``` Let's gate that functionality to WordPress 6.5+ to avoid that error.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
andrii-lysenko
left a comment
There was a problem hiding this comment.
This works good and runs with no errors.
Proposed changes:
Follow-up to #35542
Core recently changed the definition of the filter we're using to automatically add the sharing block to post templates. As a result, our code is not compatible with WordPress 6.4 anymore:
Let's gate that functionality to WordPress 6.5+ to avoid that error.
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
wp option update jetpack_sharing_buttons_auto_add true