-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix GitHub Actions failure due to duplicate functions #44052
Conversation
wp_add_global_styles_for_blocks
I'm not sure but the Could you please check it again? Thank you |
My understanding is that the performance test will not pass the test unless it is merged because trunk is also used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested your changes locally (I tried in my fork version but it was a bit complex on Github so I left it there 😅 ). Performance test step doesn't throw any re-declaration exceptions now. ➕ 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into a fix @t-hamano! For this function, I'm wondering if instead we should be using a gutenberg
prefixed version instead of attempting to use the version that's just been merged into core?
if ( ! function_exists( 'wp_add_global_styles_for_blocks' ) ) { | ||
/** | ||
* Adds global style rules to the inline style for each block. | ||
*/ | ||
function wp_add_global_styles_for_blocks() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking whether or not the core wp_add_global_styles_for_blocks
exists, should we instead rename the function to gutenberg_add_global_styles_for_blocks
so that in the plugin, we're always calling the Gutenberg version? This would make it similar to the function lower down in this file (gutenberg_get_global_stylesheet
).
if ( ! function_exists( 'wp_add_global_styles_for_blocks' ) ) { | ||
wp_add_global_styles_for_blocks(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check appears to call the function only if it doesn't exist.
Instead, should we use a gutenberg
prefixed version of the function?
Thanks for the review, @andrewserong ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for following up @t-hamano, this looks good to me, and styles appear to be output correctly on my test site.
Now we just need someone with access to merge this in 😄
Thanks for merging, @noisysocks! 🙇 |
Thank you for addressing, @t-hamano and @andrewserong! Here's some more discussion on the issue: WordPress/wordpress-develop#3206 (comment) |
I'm going to release GB 14.0.3 in a bit to include this fix, in order to make it possible to run GB stable against Core |
* Add redeclaration check of `wp_add_global_styles_for_blocks` * Add skip redirection * Use gutenberg_ prefix
What?
This PR checks for redeclarations in the
wp_add_global_styles_for_blocks
function and resolves Fatal errors in gitHub Actions.In some actions, the following Fatal Error occurs:
Why?
A backport was done on Changeset 54118 in WordPress core and
wp_add_global_styles_for_blocks
was added.I believe this problem occurred because the function is not checked on the Gutenberg.
How?
I followed this best practice and added checks by
function_exists
.Testing Instructions
In this PR, confirm that all tests pass.Confrim that all tests pass, except for the performance test where trunk is used.