WordPress.org

Make WordPress Core

Ticket #30448: 30448-customizer-patch.diff

File 30448-customizer-patch.diff, 824 bytes (added by CrazyJaco, 5 years ago)

New filter in customizer setting class.

  • wp-includes/class-wp-customize-setting.php

    diff --git wp-includes/class-wp-customize-setting.php wp-includes/class-wp-customize-setting.php
    index 0207b70..1fc976d 100644
    class WP_Customize_Setting { 
    171171         * @return false|null False if cap check fails or value isn't set.
    172172         */
    173173        public final function save() {
    174                 $value = $this->post_value();
     174
     175                /**
     176                 * Filter a Customize setting value before the setting is saved.
     177                 *
     178                 * @since 4.2.0
     179                 *
     180                 * @param mixed                $value Value of the setting.
     181                 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
     182                 */
     183                $value = apply_filters( 'customize_save_value', $this->post_value(), $this );
    175184
    176185                if ( ! $this->check_capabilities() || ! isset( $value ) )
    177186                        return false;