-
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
Full Site Editing: Avoid throwing warnings if there are no terms for a template or template part #27210
Conversation
Size Change: +254 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
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 is working for me! 👍
I saw this error today for templates created before the taxonomy refactor was introduced 👍 |
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.
🚢
Description
Fixes #27172
A recent change added the
wp_theme
taxonomy to the wp-admin lists of templates and template parts.I didn't consider that
get_the_terms
returns false instead of an empty array if it doesn't find anything.After the many changes on the
wp_template
andwp_template_part
custom post types, we currently assign the current theme slug towp_theme
on templates and parts creation.Therefore, new templates would never trigger this warning.
While older templates (without
wp_theme
taxonomy) are barely supported now, it's still appropriate to make sure the data is valid before looping through it.How has this been tested?
/wp-admin/edit.php?post_type=wp_template
and/wp-admin/edit.php?post_type=wp_template_part
.wp_theme
tag, make sure there are no warning in the PHP log.Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: