#35242 closed defect (bug) (fixed)
PHP Noticed caused by Customizer if widgets panel removed
Reported by: | DJPaul | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Customize | Keywords: | has-patch |
Focuses: | Cc: |
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
@
9 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
@
9 years ago
- Keywords has-patch added
35242.diff adds a _doing_it_wrong warning. Thoughts?
#5
in reply to:
↑ 4
@
9 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/
#7
@
9 years ago
- Owner set to westonruter
- Resolution set to fixed
- Status changed from new to closed
In 36216:
#8
@
9 years ago
- Milestone changed from Awaiting Review to 4.5
- Resolution fixed deleted
- Status changed from closed to 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.
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?