Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use wp_get_theme()->is_block_theme() inside the wp_is_block_theme fun…
…ction.

See the discussion here: https://core.trac.wordpress.org/ticket/54552
  • Loading branch information
anton-vlasenko committed Dec 6, 2021
commit 09d406230dde56eade1c2f27879e73f8cd7ac006
3 changes: 1 addition & 2 deletions src/wp-includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -4091,6 +4091,5 @@ function create_initial_theme_features() {
* @return boolean Whether the current theme is a block-based theme or not.
*/
function wp_is_block_theme() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anton-vlasenko As Gutenberg has to support WP 5.7 and 5.8, how will renaming this function impact the plugin? Are you planning to rename it in Gutenberg too and deprecate the original name? Or does renaming not affect Gutenberg?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hellofromtonya Companion issue is here and the PR for that issue seems to have been updated in line with this page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @costdev for pointing that out.

Copy link
Author

@anton-vlasenko anton-vlasenko Dec 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hellofromtonya
Yes, I'm planning to rename it in Gutenberg. I've created a PR that renames it.
IMO it doesn't make sense to keep both wp_is_block_theme and wp_is_block_template_theme functions in WordPress Core.
I think we still have time to rename it in Gutenberg before the Gutenberg 12.1.0 release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anton-vlasenko. Part of the consolidation discuss is to help with the backports from Gutenberg to Core. So wanted to make sure whatever happens here also happens in the Gutenberg repo too, i.e. code matches.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making sure, @hellofromtonya.
I 100% agree.
We need to be careful to make sure we don't break Gutenberg.

return is_readable( get_theme_file_path( '/block-templates/index.html' ) ) ||
is_readable( get_theme_file_path( '/templates/index.html' ) );
return wp_get_theme()->is_block_theme();
}