Remove GB prefixed functions from template part#36180
Conversation
| ) { | ||
| $block['attrs']['theme'] = wp_get_theme()->get_stylesheet(); | ||
| $has_updated_content = true; | ||
| if ( ! function_exists( '_inject_theme_attribute_in_block_template_content' ) ) { |
There was a problem hiding this comment.
I think that works until we do some changes in these functions for future releases. It might never be required so I think it's fine for now.
There was a problem hiding this comment.
In general is it okay to rename function without the GB prefix in the plugin? I guess for functionality that is added through filters or actions we don't rename and bail early like here, but in util functions?
We already have the problem of not being able to change some functions like here.
Are there any instructions for how these cases are handled? --cc @gziolo
There was a problem hiding this comment.
There are no rules for updating the functionality that is in WP core. If the utility function doesn’t fit anymore you can always deprecate it and create a new one.
youknowriad
left a comment
There was a problem hiding this comment.
While this solves the template part block code issue. I did rename a lot more functions on the core patch and there's a lot of functions that might need to have a function check before redefining here.
Will look into these changes. |
|
It would be helpful to move the code that is about to be include in WordPress 5.9 to the |
| ) { | ||
| $block['attrs']['theme'] = wp_get_theme()->get_stylesheet(); | ||
| $has_updated_content = true; | ||
| if ( ! function_exists( '_inject_theme_attribute_in_block_template_content' ) ) { |
There was a problem hiding this comment.
There are no rules for updating the functionality that is in WP core. If the utility function doesn’t fit anymore you can always deprecate it and create a new one.
This will be needed for back porting the FSE changes in core: WordPress/wordpress-develop#1796