Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-customize-setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ protected function update( $value ) {
*/
do_action( "customize_update_{$this->type}", $value, $this );

return has_action( "customize_update_{$this->type}" );
return (bool) has_action( "customize_update_{$this->type}" );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting {

/**
* @since 3.4.0
* @since 7.0.0 Return type updated from void to true for compatibility with base class.
*
* @param mixed $value The value to update. Not used.
* @return true Always returns true.
*/
public function update( $value ) {
remove_theme_mod( 'background_image_thumb' );
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ class WP_Customize_Filter_Setting extends WP_Customize_Setting {
* Saves the value of the setting, using the related API.
*
* @since 3.4.0
* @since 7.0.0 Return type updated from void to true for compatibility with base class.
*
* @param mixed $value The value to update.
* @return true Always returns true.
*/
public function update( $value ) {}
public function update( $value ) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting {

/**
* @since 3.4.0
* @since 7.0.0 Return type updated from void to true for compatibility with base class.
*
* @global Custom_Image_Header $custom_image_header
*
* @param mixed $value The value to update.
* @return true Always returns true.
*/
public function update( $value ) {
global $custom_image_header;
Expand All @@ -58,5 +60,6 @@ public function update( $value ) {
} else {
$custom_image_header->set_header_image( $value );
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -759,17 +759,18 @@ public function sanitize( $value ) {
* To delete a menu, the client can send false as the value.
*
* @since 4.3.0
* @since 7.0.0 Return type updated from null|void to bool for compatibility with base class.
*
* @see wp_update_nav_menu_item()
*
* @param array|false $value The menu item array to update. If false, then the menu item will be deleted
* entirely. See WP_Customize_Nav_Menu_Item_Setting::$default for what the value
* should consist of.
* @return null|void
* @return bool Whether updated.
*/
protected function update( $value ) {
if ( $this->is_updated ) {
return;
return ( 'error' !== $this->update_status );
}

$this->is_updated = true;
Expand Down Expand Up @@ -806,19 +807,19 @@ protected function update( $value ) {
if ( ! $nav_menu_setting || ! ( $nav_menu_setting instanceof WP_Customize_Nav_Menu_Setting ) ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'unexpected_nav_menu_setting' );
return;
return false;
}

if ( false === $nav_menu_setting->save() ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'nav_menu_setting_failure' );
return;
return false;
}

if ( (int) $value['nav_menu_term_id'] !== $nav_menu_setting->previous_term_id ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'unexpected_previous_term_id' );
return;
return false;
}

$value['nav_menu_term_id'] = $nav_menu_setting->term_id;
Expand All @@ -832,19 +833,19 @@ protected function update( $value ) {
if ( ! $parent_nav_menu_item_setting || ! ( $parent_nav_menu_item_setting instanceof WP_Customize_Nav_Menu_Item_Setting ) ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'unexpected_nav_menu_item_setting' );
return;
return false;
}

if ( false === $parent_nav_menu_item_setting->save() ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'nav_menu_item_setting_failure' );
return;
return false;
}

if ( (int) $value['menu_item_parent'] !== $parent_nav_menu_item_setting->previous_post_id ) {
$this->update_status = 'error';
$this->update_error = new WP_Error( 'unexpected_previous_post_id' );
return;
return false;
}

$value['menu_item_parent'] = $parent_nav_menu_item_setting->post_id;
Expand Down Expand Up @@ -886,6 +887,8 @@ protected function update( $value ) {
}
}
}

return ( 'error' !== $this->update_status );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ public function sanitize( $value ) {
* To delete a menu, the client can send false as the value.
*
* @since 4.3.0
* @since 7.0.0 Return type updated from null|void to bool for compatibility with base class.
*
* @see wp_update_nav_menu_object()
*
Expand All @@ -478,11 +479,11 @@ public function sanitize( $value ) {
* @type int $parent The id of the parent term. Default 0.
* @type bool $auto_add Whether pages will auto_add to this menu. Default false.
* }
* @return null|void
* @return bool Whether updated.
*/
protected function update( $value ) {
if ( $this->is_updated ) {
return;
return ( 'error' !== $this->update_status );
}

$this->is_updated = true;
Expand Down Expand Up @@ -582,6 +583,8 @@ protected function update( $value ) {
$this->_widget_nav_menu_updates[ $nav_menu_widget_setting->id ] = $updated_widget_instance;
}
}

return ( 'error' !== $this->update_status );
}

/**
Expand Down
Loading