Make WordPress Core

Changeset 36216


Ignore:
Timestamp:
01/07/2016 06:05:07 AM (11 years ago)
Author:
westonruter
Message:

Customizer: Call _doing_it_wrong() if widgets or nav_menus are manually removed via WP_Customize_Manager::remove_panel().

Advise that the customize_loaded_components filter should be used instead.

Props voldemortensen.
See #33552.
Fixes #35242.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r35923 r36216  
    11991199         */
    12001200        public function remove_panel( $id ) {
     1201                $core_panels = array(
     1202                        'widgets',
     1203                        'nav_menus',
     1204                );
     1205                if ( in_array( $id, $core_panels, true ) ) {
     1206                        $url = 'https://core.trac.wordpress.org/ticket/33552#comment:12';
     1207                        _doing_it_wrong(
     1208                                __METHOD__,
     1209                                sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the <code>customize_loaded_components</code> filter instead. See <a href="%2$s">%2$s</a>.' ), $id, $url ),
     1210                                '4.5'
     1211                        );
     1212                }
    12011213                unset( $this->panels[ $id ] );
    12021214        }
Note: See TracChangeset for help on using the changeset viewer.