WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2020 10:43:21 PM (14 months ago)
Author:
SergeyBiryukov
Message:

Themes: Add a return value to set_theme_mod() to allow for error handling.

Props latifi, hareesh-pillai.
Fixes #51296.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r49193 r49214  
    10391039 *
    10401040 * @since 2.1.0
     1041 * @since 5.6.0 A return value was added.
    10411042 *
    10421043 * @param string $name  Theme modification name.
    10431044 * @param mixed  $value Theme modification value.
     1045 * @return bool True if the value was updated, false otherwise.
    10441046 */
    10451047function set_theme_mod( $name, $value ) {
     
    10621064
    10631065    $theme = get_option( 'stylesheet' );
    1064     update_option( "theme_mods_$theme", $mods );
     1066
     1067    return update_option( "theme_mods_$theme", $mods );
    10651068}
    10661069
     
    10881091        return;
    10891092    }
     1093
    10901094    $theme = get_option( 'stylesheet' );
     1095
    10911096    update_option( "theme_mods_$theme", $mods );
    10921097}
     
    11051110        $theme_name = wp_get_theme()->get( 'Name' );
    11061111    }
     1112
    11071113    delete_option( 'mods_' . $theme_name );
    11081114}
Note: See TracChangeset for help on using the changeset viewer.