Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38864 closed defect (bug) (fixed)

Customize: Settings of custom types should return post_value when value() called

Reported by: westonruter's profile westonruter Owned by: westonruter's profile westonruter
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Customize Keywords: has-patch
Focuses: Cc:

Description (last modified by westonruter)

When a custom setting type is supplied when constructing a the base WP_Customize_Setting class, then the plugin implementing the custom type is expected to supply the value via the customize_value_{$id_base} filter which is then returned in the call to WP_Customize_Setting::value(). When a setting is previewed, however, it is expected that the WP_Customize_Setting::value() returns the previewed (post) value instead of whatever the customize_value_{$id_base} filter returned. This is not currently the case.

This issue is clearly seen when adding a setting via code like:

<?php
$wp_customize->add_setting( 'test_number', array(
        'type' => 'demo',
) );

When loading the customizer and supplying a value for that setting, if you then try to reload the customizer so that the stored changeset restores the customized state upon reload, you'll see that the input is unexpectedly empty.

Attachments (2)

38864.0.diff (1.6 KB) - added by westonruter 8 years ago.
38864.1.diff (2.7 KB) - added by westonruter 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @westonruter
8 years ago

  • Description modified (diff)

@westonruter
8 years ago

#2 @westonruter
8 years ago

  • Keywords has-patch added

@westonruter
8 years ago

#3 @westonruter
8 years ago

  • Owner set to westonruter
  • Resolution set to fixed
  • Status changed from new to closed

In 39318:

Customize: Ensure WP_Customize_Setting::value() returns previewed value for custom types utilizing the customize_value_{$id_base} filter.

Fixes #38864.

Note: See TracTickets for help on using tickets.