-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
PHP notice in the site editor #22800
Comments
You need to have at least an |
My bad! I'll work on a fix tomorrow. |
Requiring and index.html makes sense considering the template hierarchy, but the notice shows when front-page.html is missing, not when index.html is missing. |
To repro this:
|
Yes, there is a bug there.
Doesn't that mean there isn't an |
Right, this is one part of the problem. I think I'm setting the wrong key here: gutenberg/lib/edit-site-page.php Line 158 in 710373b
This will use the name of the template that was found, not the name of the key that was looked for. So if we're looking up I think the fix for this is to use the template we were looking for as key: diff --git a/lib/edit-site-page.php b/lib/edit-site-page.php
index 817c3ef9cb..0dcaf92d6a 100644
--- a/lib/edit-site-page.php
+++ b/lib/edit-site-page.php
@@ -155,7 +155,7 @@ function gutenberg_edit_site_init( $hook ) {
$current_template = gutenberg_find_template_post_and_parts( $template_type );
if ( isset( $current_template ) ) {
- $template_ids[ $current_template['template_post']->post_name ] = $current_template['template_post']->ID;
+ $template_ids[ $template_type ] = $current_template['template_post']->ID;
$template_part_ids = $template_part_ids + $current_template['template_part_ids'];
}
} This should make the error go away when there's no
The theme I was testing this with was Twenty Twenty (i.e. not the 'Blocks' version), so no |
That fix makes sense. Let's ship it. |
Working on a PR that also addresses this problem. |
Describe the bug
With 8.2.0 and later, this notice is showing in the site editor
Notice: Undefined index: front-page in /var/www/html/wp-content/plugins/gutenberg/lib/edit-site-page.php on line 162
https://github.com/WordPress/gutenberg/blob/master/lib/edit-site-page.php#L162
To reproduce
Steps to reproduce the behavior:
https://github.com/WordPress/theme-experiments
Expected behavior
I expect experimental features to change often, but not be broken in the plugin releases. :)
Editor version (please complete the following information):
WordPress version: 5.4.1
Gutenberg: 8.2.0, 8.2.1
PHP version: 7.3.13
Desktop (please complete the following information):
Windows 10
Chrome version: 83.0.4103.61
The text was updated successfully, but these errors were encountered: