[wp-trac] [WordPress Trac] #33552: Facilitate plugins to override Customizer features

WordPress Trac noreply at wordpress.org
Tue Oct 20 20:15:43 UTC 2015


#33552: Facilitate plugins to override Customizer features
------------------------------------+--------------------------
 Reporter:  westonruter             |       Owner:  westonruter
     Type:  enhancement             |      Status:  assigned
 Priority:  normal                  |   Milestone:  4.4
Component:  Customize               |     Version:  3.9
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+--------------------------

Comment (by westonruter):

 With [attachment:33552.diff], all the use cases I can image would be
 achievable:

 Remove a component from being loaded:

 {{{#!php
 <?php
 add_action( 'customize_manager_construct', function ( $manager ) {
     $manager->nav_menus = false;
 });
 }}}

 To replace a component with another implementation:

 {{{#!php
 <?php
 add_action( 'customize_manager_construct', function ( $manager ) {
     require_once( __DIR__ . '/class-my-customize-widgets.php' );
     $manager->widgets = new My_Customize_Widgets( $manager );
 });
 }}}

 And to add an entirely new component, similar to the previous:

 {{{#!php
 <?php
 add_action( 'customize_manager_construct', function ( $manager ) {
     require_once( __DIR__ . '/class-my-customize-comments.php' );
     $manager->comments = new My_Customize_Comments( $manager );
 });
 }}}

 Maybe `customize_construct` would be better than
 `customize_manager_construct` for an action name.

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


More information about the wp-trac mailing list