[wp-trac] [WordPress Trac] #54905: PHP notice while accessing Customizer

WordPress Trac noreply at wordpress.org
Sun Sep 11 20:24:02 UTC 2022


#54905: PHP notice while accessing Customizer
-------------------------------------------------+-------------------------
 Reporter:  Boniu91                              |       Owner:
                                                 |  westonruter
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  6.1
Component:  Customize                            |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-testing-info has-screenshots     |     Focuses:
  has-patch dev-feedback                         |
-------------------------------------------------+-------------------------
Changes (by westonruter):

 * owner:  (none) => westonruter
 * status:  new => accepted


Comment:

 After a lot of digging, I finally found the cause. The issue was
 introduced in [52621] where a
 `WP_Customize_Nav_Menus_Panel::check_capabilities()` method override was
 introduced which caused the return to be `false` if the current theme
 doesn't support `menus` nor `widgets`. Original PR:
 https://github.com/WordPress/wordpress-develop/pull/2217

 The problem is that since `check_capabilities` returns false, when
 `WP_Customize_Manager::prepare_controls()` runs it will remove any
 registered panels that the user doesn't have the capability to manage.

 Ironically, I actually reviewed that PR and I thought the approach would
 work, but clearly it doesn't. I did provide an alternative solution,
 however, which should actually fix the issue here:
 https://github.com/WordPress/wordpress-
 develop/pull/2217#discussion_r790977534

 I'll create a patch for this.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54905#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list