[wp-trac] [WordPress Trac] #40527: Decouple WP_Customize_Manager

WordPress Trac noreply at wordpress.org
Sat Apr 22 11:00:00 UTC 2017

#40527: Decouple WP_Customize_Manager
 Reporter:  utkarshpatel  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Customize     |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
 When you create multiple instances of `WP_Customize_Manager` it
 adds/removes multiple hooks in its constructor which should be executed
 single time.

 So let's say if I want to create two new changeset posts it I will do.

 $data = array(
 ... // Some changeset data.
 $manager1 = new WP_Customize_Manager();
 $manager1->save_changeset_post( array( 'data' => $data ) );

 $manager2 = new WP_Customize_Manager();
 $manager2->save_changeset_post( array( 'data' => $data ) );

 This will cause `wp_ajax_customize_save` to add twice with `$manager1` and
 `$manager2` it should add only once.

 `wp_ajax_customize_save` is a just example.

 See Constructor:

 So we should decouple `WP_Customize_Manager` class and maybe extract
 changeset methods in separate class `WP_Customize_Changeset`.

Ticket URL: <https://core.trac.wordpress.org/ticket/40527>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list