[wp-trac] [WordPress Trac] #30988: Setting's default value doesn't apply on preview window

WordPress Trac noreply at wordpress.org
Fri Jan 16 05:31:09 UTC 2015


#30988: Setting's default value doesn't apply on preview window
-------------------------------------------------+-------------------------
 Reporter:  Aniruddh                             |       Owner:
     Type:  defect (bug)                         |  westonruter
 Priority:  normal                               |      Status:  reviewing
Component:  Customize                            |   Milestone:  4.1.1
 Severity:  normal                               |     Version:  4.1
 Keywords:  needs-testing needs-patch reporter-  |  Resolution:
  feedback                                       |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------
Changes (by westonruter):

 * keywords:  needs-testing needs-patch => needs-testing needs-patch
     reporter-feedback


Comment:

 Replying to [comment:8 Aniruddh]:
 > Sorry, I did not mention that when I tested the patch, I deleted the
 option row from the table.
 >
 > So, I was under impression that customizer will save default values to
 empty table row but instead it saved values of those settings whose
 default values were changed.

 So you did `delete_option( 'my_settings' )` before testing? And then when
 saving the `my_settings[bg_color]` setting with the value `#CCCCCC` the
 result was that no `my_settings` option was added? And yet if you were to
 try saving `my_settings[bg_color]` to something else, like `#000000`, then
 it succeeded in creating the `my_settings` option?

 I don't see why this would happen according to my theory above, because
 the setting's `preview()` method doesn't get called when a
 `customize_save` WP Ajax request is made. I tried registering a setting
 for a non-existent option, and when I tried saving the setting with the
 default value, the value was successfully saved to the DB as a new option.
 (Could your issue actually be #28701? Do you have an external object
 cache?)

 Could you share some more of your sample code, preferably a self-contained
 plugin, which I can use to reproduce the issue?

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


More information about the wp-trac mailing list