[wp-trac] [WordPress Trac] #44976: Proposal to add deregister_control_type() method to WP_Customize_Manager

WordPress Trac noreply at wordpress.org
Fri Sep 21 11:52:39 UTC 2018


#44976: Proposal to add deregister_control_type() method to WP_Customize_Manager
-------------------------------------------------+-------------------------
 Reporter:  Collizo4sky                          |       Owner:  (none)
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Customize                            |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing dev-         |     Focuses:
  feedback                                       |  accessibility
-------------------------------------------------+-------------------------
Changes (by mukesh27):

 * keywords:  has-patch 2nd-opinion reporter-feedback => has-patch needs-
     testing dev-feedback
 * focuses:   => accessibility


Comment:

 @Collizo4sky, So you want to deregister control type not control.

 I have tested your patch and found that it is not remove control type when
 i call below function in theme functions.php file.

 {{{ $wp_customize->deregister_control_type( 'WP_Customize_Color_Control'
 ); }}}

 i have checked your code and found that it's return notice when we try to
 deregister any controls. You can please try rewise patch that i have do
 and added two new functions to deregister panel and section also.

 After applying patch you can check like below functions.

 To deregister any control type add below function in {{{
 customize_register }}} action like below

 {{{#!php
 <?php
 function customize_deregister_control_type( $wp_customize ) {
         $wp_customize->deregister_control_type(
 'WP_Customize_Color_Control' );
 }
 add_action( 'customize_register', 'customize_deregister_control_type' );
 }}}

 To deregister any panel type add below function in {{{ customize_register
 }}} action like below

 {{{#!php
 <?php
 function customize_deregister_panel_type( $wp_customize ) {
         $wp_customize->deregister_panel_type( 'WP_Customize_Themes_Panel'
 );
 }
 add_action( 'customize_register', 'customize_deregister_panel_type' );
 }}}


 To deregister any section type add below function in {{{
 customize_register }}} action like below

 {{{#!php
 <?php
 function customize_deregister_section_type( $wp_customize ) {
         $wp_customize->deregister_section_type( 'WP_Customize_Section' );
 }
 add_action( 'customize_register', 'customize_deregister_section_type' );
 }}}

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


More information about the wp-trac mailing list