[wp-trac] [WordPress Trac] #48747: WP_Customize_Setting doesn't clean up after itself

WordPress Trac noreply at wordpress.org
Thu Nov 21 22:05:47 UTC 2019


#48747: WP_Customize_Setting doesn't clean up after itself
-------------------------------+------------------------------
 Reporter:  jon81              |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Customize          |     Version:  3.4
 Severity:  minor              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by westonruter):

 Replying to [comment:1 dlh]:
 > I'm not sure whether there's a historical reason that the
 `WP_Customize_Manager::remove_*()` methods don't attempt to remove any
 hooks associated with the removed constructs. @westonruter sorry for the
 ping, but do you know?

 Hi! I think it's just because it's not a need that came up. I thought
 there was some ticket for it, but I couldn't find it.

 It's not great that the constructor for `WP_Customize_Setting` is calling
 `add_filter()` right away. It would be better if those filters were added
 later once they would be used. Alas.

 In any case, I suggest removing the filters. Assuming there is only a
 `sanitize_callback` you can just do:

 {{{#!php
 <?php
 remove_all_filters( 'customize_sanitize_header_footer_background_color' );
 }}}

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


More information about the wp-trac mailing list