#35242 closed defect (bug) (fixed)
PHP Noticed caused by Customizer if widgets panel removed
| Reported by: | DJPaul | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.5 |
| Component: | Customize | Version: | 4.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
If $wp_customize->remove_panel( 'widgets' ); is done, the Customizer throws a PHP Notice:
PHP Notice: Trying to get property of non-object in /srv/www/buddypress.dev/src/wp-includes/class-wp-customize-widgets.php on line 716
Tested on 4.4 SVN branch.
Attachments (3)
Change History (14)
#3
@
11 years ago
Thanks. I discovered the remove_panel method from a blog post on make/core. Maybe the docblock for remove_panel could say don't use this to remove the core widgets or nav menus panels, maybe.
#4
follow-up:
↓ 5
@
11 years ago
- Keywords has-patch added
35242.diff adds a _doing_it_wrong warning. Thoughts?
#5
in reply to: ↑ 4
@
11 years ago
Replying to voldemortensen:
35242.diff adds a _doing_it_wrong warning. Thoughts?
Good idea.
Feedback:
'WP_Customize_Manager::remove_panel'can be replaced with__METHOD__.- Version can be
'4.4'since that is when the filter was introduced. - The filter is actually
customize_loaded_components. - The link references an older proposal. I just commented with the necessary code snippets: https://core.trac.wordpress.org/ticket/33552#comment:12 Or also the Make Core post can be referenced: https://make.wordpress.org/core/2015/12/02/customizer-improvements-in-4-4/
#8
@
11 years ago
- Milestone Awaiting Review → 4.5
- Resolution fixed
- Status closed → reopened
Following [36216]:
- Instead of arbitrarily linking a Trac comment, let's link to the code reference page for the hook where I have conveniently added simplified versions of the examples from comment:12:ticket:33552 :-)
<code>customize_loaded_components</code>shouldn't be translatable- The string is missing a translator comment for the specifiers
All of the above are done in 35242.2.diff.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi @DJPaul — there's a special way to remove a Customizer component.
Perhaps we need to review documentation here, to point developers in the right direction?