Make WordPress Core

Changeset 27393


Ignore:
Timestamp:
03/04/2014 07:01:45 AM (11 years ago)
Author:
nacin
Message:

Add a pre_set_theme_mod_$name filter to set_theme_mod().

This is modeled after pre_update_option_$option in update_option() and pre_set_transient_$transient in set_transient().

props obenland.
fixes #14721.

File:
1 edited

Legend:

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

    r27217 r27393  
    914914function set_theme_mod( $name, $value ) {
    915915    $mods = get_theme_mods();
    916 
    917     $mods[ $name ] = $value;
     916    $old_value = $mods[ $name ];
     917
     918    /**
     919     * Filter the theme mod value on save.
     920     *
     921     * The dynamic portion of the hook name, $name, refers to the key name of
     922     * the modification array. For example, 'header_textcolor', 'header_image',
     923     * and so on depending on the theme options.
     924     *
     925     * @since 3.9.0
     926     *
     927     * @param string $value     The new value of the theme mod.
     928     * @param string $old_value The current value of the theme mod.
     929     */
     930    $mods[ $name ] = apply_filters( "pre_set_theme_mod_$name", $value, $old_value );
    918931
    919932    $theme = get_option( 'stylesheet' );
Note: See TracChangeset for help on using the changeset viewer.