Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#34139 closed defect (bug) (invalid)

Widgets panel missing in Customizer when there is some error

Reported by: pavelevap's profile pavelevap Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Customize Keywords: reporter-feedback
Focuses: Cc:

Description

I accidentally caused Fatal error in footer.php theme file. Customizer worked well in this case, the only problem was with Widgets panel which was missing. I am not sure if it is expected behaviour, but Menu and all other panels works well...

Change History (8)

#1 @westonruter
9 years ago

  • Keywords reporter-feedback added

@pavelevap: We're going to need more details here to be able to identify if this is a Core bug or not. It sounds like a problem specific to your theme. Share your footer.php.

#2 @pavelevap
9 years ago

You can do whatever to create some Fatal error, for example this (without activating WooCommerce):

$produkt = new WC_Product( $id );

There is expected Fatal error "Class 'WC_Product' not found in \wp-content\themes\twentyfifteen\footer.php"

But everything works in Customizer, all panels are active except "Widgets" panel which is not displayed. I did not notice this error and investigated why it is not possible to manage Widgets in Customizer.

#3 @DrewAPicture
9 years ago

@pavelevap Do you have any sidebars outside of your footer? If a fatal is preventing the footer from loading, it seems likely the Widgets panel wouldn't show up if there were no widgets to configure.

#4 @westonruter
9 years ago

  • Keywords close added

There is probably a fatal that is preventing the script data to be exported in the footer, resulting in the preview never communicating that there are sidebars on the template.

As for why the fatal is happening, you already said that WooCommerce wasn't activated and so that WC_Product class would not be defined. You are probably getting this same error outside the Customizer but your errors are not being displayed. Wrap the logic that tries to instantiate the class in a class_exists() check.

#5 follow-up: @pavelevap
9 years ago

Yes, I know how to avoid this error, I was only surprised, that everything worked as expected (even with this error) in Customizer, so I could edit Menu and other settings. The only thing which did not work is Widgets.

I am using Twenty Fifteen and latest trunk. I can see Fatal error in Customizer and website also.

When Fatal error is before wp_footer() call, then "Widget" panel is not displayed. When Fatal error is after wp_footer(), then everything works well. Main problem is that users usually do not see errors (configured by webhosting company) and they can search for "Widgets" panel in Customizer and ask "Where is it?". I think that panel should be displayed even if there is Fatal error...

#6 in reply to: ↑ 5 @swissspidy
9 years ago

Replying to pavelevap:

I think that panel should be displayed even if there is Fatal error...

That wouldn't be very helpful to users as the widget panel would be un-usable because of the fatal error.

As Weston already said, the fatal is preventing the script data to be exported in the footer, resulting in the preview never communicating that there are sidebars on the template.

#7 follow-up: @pavelevap
9 years ago

OK, I understand it, but for users it is also not very helpful when Widgets panel is hidden, but widgets can be seen in Customizer preview. Users will be lost and searching "Where is my panel?" and how to manage widgets. They do not know that something is wrong in theme code and the only visible problem is missing Widgets panel...

#8 in reply to: ↑ 7 @westonruter
9 years ago

  • Component changed from General to Customize
  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Replying to pavelevap:

OK, I understand it, but for users it is also not very helpful when Widgets panel is hidden, but widgets can be seen in Customizer preview. Users will be lost and searching "Where is my panel?" and how to manage widgets. They do not know that something is wrong in theme code and the only visible problem is missing Widgets panel...

For that, please see #33052.

Note: See TracTickets for help on using tickets.