[wp-trac] [WordPress Trac] #32103: Customizer sanitizes data multiple times when options are served as Serialized Settings

WordPress Trac noreply at wordpress.org
Fri Apr 24 22:36:47 UTC 2015


#32103: Customizer sanitizes data multiple times when options are served as
Serialized Settings
--------------------------+------------------------------------------
 Reporter:  Air.          |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  Future Release
Component:  Customize     |     Version:  3.4
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  administration, performance
--------------------------+------------------------------------------
Changes (by westonruter):

 * keywords:   => needs-patch
 * owner:   => westonruter
 * version:  4.2 => 3.4
 * status:  new => accepted
 * milestone:  Awaiting Review => Future Release


Comment:

 Yes, this is a problem I've noticed recently. It is especially
 problematic/evident with widgets, when you have a lot of them. I was
 noticing the Customizer's sanitization methods being called 50K+ times
 each time with each request. The workaround/solution I've put in place for
 a current client project (for which I'll be working on a patch to share)
 is to register a new Customizer setting type for `widget`, and then to
 store the unserialized settings in memory, and perform the sanitization on
 just the specific setting instance as needed. Then when saving the
 Customizer setting, the whole array gets re-serialized and stored in the
 option.

 As an aside, widgets are not scalable as they exist in Core right now.
 I've been working on a feature plugin that introduces a `widget_instance`
 post type to store each widget individually as a separate DB entry (in the
 `wp_posts` table). This also gets around the poor performance of having to
 re-serialize the entire option value.

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


More information about the wp-trac mailing list