Make WordPress Core

Changeset 27365


Ignore:
Timestamp:
03/02/2014 11:34:08 PM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-includes/option.php.

Props siobhyb for the initial patch. Props DrewAPicture, kpdesign.
Fixes #25905.

File:
1 edited

Legend:

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

    r27262 r27365  
    1818 *
    1919 * @since 1.5.0
    20  * @uses apply_filters() Calls 'pre_option_$option' before checking the option.
    21  *  Any value other than false will "short-circuit" the retrieval of the option
    22  *  and return the returned value. You should not try to override special options,
    23  *  but you will not be prevented from doing so.
    24  * @uses apply_filters() Calls 'option_$option', after checking the option, with
    25  *  the option value.
    2620 *
    2721 * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
     
    3630        return false;
    3731
    38     // Allow plugins to short-circuit options.
     32    /**
     33     * Filter the value of an existing option before it is retrieved.
     34     *
     35     * The dynamic portion of the hook name, $option, refers to the option name.
     36     *
     37     * Passing a truthy value to the filter will short-circuit retrieving
     38     * the option value, returning the passed value instead.
     39     *
     40     * @since 1.5.0
     41     *
     42     * @param bool|mixed $pre_option Value to return instead of the option value.
     43     *                               Default false to skip it.
     44     */
    3945    $pre = apply_filters( 'pre_option_' . $option, false );
    4046    if ( false !== $pre )
     
    4854        $notoptions = wp_cache_get( 'notoptions', 'options' );
    4955        if ( isset( $notoptions[$option] ) )
     56
     57            /**
     58             * Filter the default value for an option.
     59             *
     60             * The dynamic portion of the hook name, $option, refers
     61             * to the option name.
     62             *
     63             * @since 3.4.0
     64             *
     65             * @param mixed $default The default value to return if the option
     66             *                       does not exist in the database.
     67             */
    5068            return apply_filters( 'default_option_' . $option, $default );
    5169
     
    6785                    $notoptions[$option] = true;
    6886                    wp_cache_set( 'notoptions', $notoptions, 'options' );
     87
     88                    /** This filter is documented in wp-includes/option.php */
    6989                    return apply_filters( 'default_option_' . $option, $default );
    7090                }
     
    7595        $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
    7696        $wpdb->suppress_errors( $suppress );
    77         if ( is_object( $row ) )
     97        if ( is_object( $row ) ) {
    7898            $value = $row->option_value;
    79         else
     99        } else {
     100            /** This filter is documented in wp-includes/option.php */
    80101            return apply_filters( 'default_option_' . $option, $default );
     102        }
    81103    }
    82104
     
    88110        $value = untrailingslashit( $value );
    89111
     112    /**
     113     * Filter the value of an existing option.
     114     *
     115     * The dynamic portion of the hook name, $option, refers to the option name.
     116     *
     117     * @since 1.5.0 As 'option_' . $setting
     118     * @since 3.0.0
     119     *
     120     * @param mixed $value Value of the option. If stored serialized, it will be
     121     *                     unserialized prior to being returned.
     122     */
    90123    return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );
    91124}
     
    192225 * @since 1.0.0
    193226 *
    194  * @uses apply_filters() Calls 'pre_update_option_$option' hook to allow overwriting the
    195  *  option value to be stored.
    196  * @uses do_action() Calls 'update_option' hook before updating the option.
    197  * @uses do_action() Calls 'update_option_$option' and 'updated_option' hooks on success.
    198  *
    199227 * @param string $option Option name. Expected to not be SQL-escaped.
    200228 * @param mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
     
    215243    $value = sanitize_option( $option, $value );
    216244    $old_value = get_option( $option );
     245
     246    /**
     247     * Filter a specific option before its value is (maybe) serialized and updated.
     248     *
     249     * The dynamic portion of the hook name, $option, refers to the option name.
     250     *
     251     * @since 2.6.0
     252     *
     253     * @param mixed $value     The new, unserialized option value.
     254     * @param mixed $old_value The old option value.
     255     */
    217256    $value = apply_filters( 'pre_update_option_' . $option, $value, $old_value );
    218257
     
    226265    $serialized_value = maybe_serialize( $value );
    227266
     267    /**
     268     * Fires immediately before an option value is updated.
     269     *
     270     * @since 2.9.0
     271     *
     272     * @param string $option    Name of the option to update.
     273     * @param mixed  $old_value The old option value.
     274     * @param mixed  $value     The new option value.
     275     */
    228276    do_action( 'update_option', $option, $old_value, $value );
     277
    229278    $result = $wpdb->update( $wpdb->options, array( 'option_value' => $serialized_value ), array( 'option_name' => $option ) );
    230279    if ( ! $result )
     
    247296    }
    248297
     298    /**
     299     * Fires after the value of a specific option has been successfully updated.
     300     *
     301     * The dynamic portion of the hook name, $option, refers to the option name.
     302     *
     303     * @since 2.0.1
     304     *
     305     * @param mixed $old_value The old option value.
     306     * @param mixed $value     The new option value.
     307     */
    249308    do_action( "update_option_{$option}", $old_value, $value );
     309
     310    /**
     311     * Fires after the value of an option has been successfully updated.
     312     *
     313     * @since 2.9.0
     314     *
     315     * @param string $option    Name of the updated option.
     316     * @param mixed  $old_value The old option value.
     317     * @param mixed  $value     The new option value.
     318     */
    250319    do_action( 'updated_option', $option, $old_value, $value );
    251320    return true;
     
    265334 *
    266335 * @since 1.0.0
    267  *
    268  * @uses do_action() Calls 'add_option' hook before adding the option.
    269  * @uses do_action() Calls 'add_option_$option' and 'added_option' hooks on success.
    270336 *
    271337 * @param string $option Name of option to add. Expected to not be SQL-escaped.
     
    300366    $serialized_value = maybe_serialize( $value );
    301367    $autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
     368
     369    /**
     370     * Fires before an option is added.
     371     *
     372     * @since 2.9.0
     373     *
     374     * @param string $option Name of the option to add.
     375     * @param mixed  $value  Value of the option.
     376     */
    302377    do_action( 'add_option', $option, $value );
    303378
     
    323398    }
    324399
     400    /**
     401     * Fires after a specific option has been added.
     402     *
     403     * The dynamic portion of the hook name, $option, refers to the option name.
     404     *
     405     * @since 2.5.0 As "add_option_{$name}"
     406     * @since 3.0.0
     407     *
     408     * @param string $option Name of the option to add.
     409     * @param mixed  $value  Value of the option.
     410     */
    325411    do_action( "add_option_{$option}", $option, $value );
     412
     413    /**
     414     * Fires after an option has been added.
     415     *
     416     * @since 2.9.0
     417     *
     418     * @param string $option Name of the added option.
     419     * @param mixed  $value  Value of the option.
     420     */
    326421    do_action( 'added_option', $option, $value );
    327422    return true;
     
    332427 *
    333428 * @since 1.2.0
    334  *
    335  * @uses do_action() Calls 'delete_option' hook before option is deleted.
    336  * @uses do_action() Calls 'deleted_option' and 'delete_option_$option' hooks on success.
    337429 *
    338430 * @param string $option Name of option to remove. Expected to not be SQL-escaped.
     
    352444    if ( is_null( $row ) )
    353445        return false;
     446
     447    /**
     448     * Fires immediately before an option is deleted.
     449     *
     450     * @since 2.9.0
     451     *
     452     * @param string $option Name of the option to delete.
     453     */
    354454    do_action( 'delete_option', $option );
     455
    355456    $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
    356457    if ( ! defined( 'WP_INSTALLING' ) ) {
     
    366467    }
    367468    if ( $result ) {
     469
     470        /**
     471         * Fires after a specific option has been deleted.
     472         *
     473         * The dynamic portion of the hook name, $option, refers to the option name.
     474         *
     475         * @since 3.0.0
     476         *
     477         * @param string $option Name of the deleted option.
     478         */
    368479        do_action( "delete_option_$option", $option );
     480
     481        /**
     482         * Fires after an option has been deleted.
     483         *
     484         * @since 2.9.0
     485         *
     486         * @param string $option Name of the deleted option.
     487         */
    369488        do_action( 'deleted_option', $option );
    370489        return true;
     
    378497 * @since 2.8.0
    379498 *
    380  * @uses do_action() Calls 'delete_transient_$transient' hook before transient is deleted.
    381  * @uses do_action() Calls 'deleted_transient' hook on success.
    382  *
    383499 * @param string $transient Transient name. Expected to not be SQL-escaped.
    384500 * @return bool true if successful, false otherwise
    385501 */
    386502function delete_transient( $transient ) {
     503
     504    /**
     505     * Fires immediately before a specific transient is deleted.
     506     *
     507     * The dynamic portion of the hook name, $transient, refers to the transient name.
     508     *
     509     * @since 3.0.0
     510     *
     511     * @param string $transient Transient name.
     512     */
    387513    do_action( 'delete_transient_' . $transient, $transient );
    388514
     
    397523    }
    398524
    399     if ( $result )
     525    if ( $result ) {
     526
     527        /**
     528         * Fires after a transient is deleted.
     529         *
     530         * @since 3.0.0
     531         *
     532         * @param string $transient Deleted transient name.
     533         */
    400534        do_action( 'deleted_transient', $transient );
     535    }
     536
    401537    return $result;
    402538}
     
    408544 * will be false.
    409545 *
    410  * @uses apply_filters() Calls 'pre_transient_$transient' hook before checking the transient.
    411  *  Any value other than false will "short-circuit" the retrieval of the transient
    412  *  and return the returned value.
    413  * @uses apply_filters() Calls 'transient_$option' hook, after checking the transient, with
    414  *  the transient value.
    415  *
    416546 * @since 2.8.0
    417547 *
     
    420550 */
    421551function get_transient( $transient ) {
     552
     553    /**
     554     * Filter the value of an existing transient.
     555     *
     556     * The dynamic portion of the hook name, $transient, refers to the transient name.
     557     *
     558     * Passing a truthy value to the filter will effectively short-circuit retrieval
     559     * of the transient, returning the passed value instead.
     560     *
     561     * @since 2.8.0
     562     *
     563     * @param mixed $pre_transient The default value to return if the transient does not exist.
     564     *                             Any value other than false will short-circuit the retrieval
     565     *                             of the transient, and return the returned value.
     566     */
    422567    $pre = apply_filters( 'pre_transient_' . $transient, false );
    423568    if ( false !== $pre )
     
    445590    }
    446591
     592    /**
     593     * Filter an existing transient's value.
     594     *
     595     * The dynamic portion of the hook name, $transient, refers to the transient name.
     596     *
     597     * @since 2.8.0
     598     *
     599     * @param mixed $value Value of transient.
     600     */
    447601    return apply_filters( 'transient_' . $transient, $value );
    448602}
     
    455609 *
    456610 * @since 2.8.0
    457  *
    458  * @uses apply_filters() Calls 'pre_set_transient_$transient' hook to allow overwriting the
    459  *  transient value to be stored.
    460  * @uses do_action() Calls 'set_transient_$transient' and 'setted_transient' hooks on success.
    461611 *
    462612 * @param string $transient Transient name. Expected to not be SQL-escaped.
     
    466616 */
    467617function set_transient( $transient, $value, $expiration = 0 ) {
     618
     619    /**
     620     * Filter a specific transient before its value is set.
     621     *
     622     * The dynamic portion of the hook name, $transient, refers to the transient name.
     623     *
     624     * @since 3.0.0
     625     *
     626     * @param mixed $value New value of transient.
     627     */
    468628    $value = apply_filters( 'pre_set_transient_' . $transient, $value );
     629
    469630    $expiration = (int) $expiration;
    470631
     
    487648        }
    488649    }
     650
    489651    if ( $result ) {
     652
     653        /**
     654         * Fires after the value for a specific transient has been set.
     655         *
     656         * The dynamic portion of the hook name, $transient, refers to the transient name.
     657         *
     658         * @since 3.0.0
     659         *
     660         * @param mixed $value      Transient value.
     661         * @param int   $expiration Time until expiration in seconds. Default 0.
     662         */
    490663        do_action( 'set_transient_' . $transient, $value, $expiration );
     664
     665        /**
     666         * Fires after the value for a transient has been set.
     667         *
     668         * @since 3.0.0
     669         *
     670         * @param string $transient  The name of the transient.
     671         * @param mixed  $value      Transient value.
     672         * @param int    $expiration Time until expiration in seconds. Default 0.
     673         */
    491674        do_action( 'setted_transient', $transient, $value, $expiration );
    492675    }
     
    698881 * Retrieve site option value based on name of option.
    699882 *
     883 * @since 2.8.0
     884 *
    700885 * @see get_option()
    701  * @since 2.8.0
    702  *
    703  * @uses apply_filters() Calls 'pre_site_option_$option' before checking the option.
    704  *  Any value other than false will "short-circuit" the retrieval of the option
    705  *  and return the returned value.
    706  * @uses apply_filters() Calls 'site_option_$option', after checking the  option, with
    707  *  the option value.
    708886 *
    709887 * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
     
    715893    global $wpdb;
    716894
    717     // Allow plugins to short-circuit site options.
     895    /**
     896     * Filter an existing site option before it is retrieved.
     897     *
     898     * The dynamic portion of the hook name, $option, refers to the option name.
     899     *
     900     * Passing a truthy value to the filter will effectively short-circuit retrieval,
     901     * returning the passed value instead.
     902     *
     903     * @since 2.9.0 As 'pre_site_option_' . $key
     904     * @since 3.0.0
     905     *
     906     * @param mixed $pre_option The default value to return if the option does not exist.
     907     */
    718908    $pre = apply_filters( 'pre_site_option_' . $option, false );
     909
    719910    if ( false !== $pre )
    720911        return $pre;
     
    723914    $notoptions_key = "{$wpdb->siteid}:notoptions";
    724915    $notoptions = wp_cache_get( $notoptions_key, 'site-options' );
    725     if ( isset( $notoptions[$option] ) )
     916
     917    if ( isset( $notoptions[$option] ) ) {
     918
     919        /**
     920         * Filter a specific default site option.
     921         *
     922         * The dynamic portion of the hook name, $option, refers to the option name.
     923         *
     924         * @since 3.4.0
     925         *
     926         * @param mixed $default The value to return if the site option does not exist
     927         *                       in the database.
     928         */
    726929        return apply_filters( 'default_site_option_' . $option, $default );
     930    }
    727931
    728932    if ( ! is_multisite() ) {
     933
     934        /** This filter is documented in wp-includes/option.php */
    729935        $default = apply_filters( 'default_site_option_' . $option, $default );
    730936        $value = get_option($option, $default);
     
    745951                $notoptions[$option] = true;
    746952                wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
     953
     954                /** This filter is documented in wp-includes/option.php */
    747955                $value = apply_filters( 'default_site_option_' . $option, $default );
    748956            }
     
    750958    }
    751959
     960    /**
     961     * Filter the value of an existing site option.
     962     *
     963     * The dynamic portion of the hook name, $option, refers to the option name.
     964     *
     965     * @since 2.9.0 As 'site_option_' . $key
     966     * @since 3.0.0
     967     *
     968     * @param mixed $value Value of site option.
     969     */
    752970    return apply_filters( 'site_option_' . $option, $value );
    753971}
     
    758976 * Existing options will not be updated. Note that prior to 3.3 this wasn't the case.
    759977 *
     978 * @since 2.8.0
     979 *
    760980 * @see add_option()
    761  * @since 2.8.0
    762  *
    763  * @uses apply_filters() Calls 'pre_add_site_option_$option' hook to allow overwriting the
    764  *  option value to be stored.
    765  * @uses do_action() Calls 'add_site_option_$option' and 'add_site_option' hooks on success.
    766981 *
    767982 * @param string $option Name of option to add. Expected to not be SQL-escaped.
     
    774989    wp_protect_special_option( $option );
    775990
     991    /**
     992     * Filter the value of a specific site option before it is added.
     993     *
     994     * The dynamic portion of the hook name, $option, refers to the option name.
     995     *
     996     * @since 2.9.0 As 'pre_add_site_option_' . $key
     997     * @since 3.0.0
     998     *
     999     * @param mixed $value Value of site option.
     1000     */
    7761001    $value = apply_filters( 'pre_add_site_option_' . $option, $value );
     1002
    7771003    $notoptions_key = "{$wpdb->siteid}:notoptions";
    7781004
     
    8071033
    8081034    if ( $result ) {
     1035
     1036        /**
     1037         * Fires after a specific site option has been successfully added.
     1038         *
     1039         * The dynamic portion of the hook name, $option, refers to the option name.
     1040         *
     1041         * @since 2.9.0 As "add_site_option_{$key}"
     1042         * @since 3.0.0
     1043         *
     1044         * @param string $option Name of site option.
     1045         * @param mixed  $value  Value of site option.
     1046         */
    8091047        do_action( "add_site_option_{$option}", $option, $value );
     1048
     1049        /**
     1050         * Fires after a site option has been successfully added.
     1051         *
     1052         * @since 3.0.0
     1053         *
     1054         * @param string $option Name of site option.
     1055         * @param mixed  $value  Value of site option.
     1056         */
    8101057        do_action( "add_site_option", $option, $value );
     1058
    8111059        return true;
    8121060    }
     
    8171065 * Removes site option by name.
    8181066 *
     1067 * @since 2.8.0
     1068 *
    8191069 * @see delete_option()
    820  * @since 2.8.0
    821  *
    822  * @uses do_action() Calls 'pre_delete_site_option_$option' hook before option is deleted.
    823  * @uses do_action() Calls 'delete_site_option' and 'delete_site_option_$option'
    824  *  hooks on success.
    8251070 *
    8261071 * @param string $option Name of option to remove. Expected to not be SQL-escaped.
     
    8321077    // ms_protect_special_option( $option ); @todo
    8331078
     1079    /**
     1080     * Fires immediately before a specific site option is deleted.
     1081     *
     1082     * The dynamic portion of the hook name, $option, refers to the option name.
     1083     *
     1084     * @since 3.0.0
     1085     */
    8341086    do_action( 'pre_delete_site_option_' . $option );
    8351087
     
    8471099
    8481100    if ( $result ) {
     1101
     1102        /**
     1103         * Fires after a specific site option has been deleted.
     1104         *
     1105         * The dynamic portion of the hook name, $option, refers to the option name.
     1106         *
     1107         * @since 2.9.0 As "delete_site_option_{$key}"
     1108         * @since 3.0.0
     1109         *
     1110         * @param string $option Name of the site option.
     1111         */
    8491112        do_action( "delete_site_option_{$option}", $option );
     1113
     1114        /**
     1115         * Fires after a site option has been deleted.
     1116         *
     1117         * @since 3.0.0
     1118         *
     1119         * @param string $option Name of the site option.
     1120         */
    8501121        do_action( "delete_site_option", $option );
     1122
    8511123        return true;
    8521124    }
     
    8571129 * Update the value of a site option that was already added.
    8581130 *
     1131 * @since 2.8.0
     1132 *
    8591133 * @see update_option()
    860  * @since 2.8.0
    861  *
    862  * @uses apply_filters() Calls 'pre_update_site_option_$option' hook to allow overwriting the
    863  *  option value to be stored.
    864  * @uses do_action() Calls 'update_site_option_$option' and 'update_site_option' hooks on success.
    8651134 *
    8661135 * @param string $option Name of option. Expected to not be SQL-escaped.
     
    8741143
    8751144    $old_value = get_site_option( $option );
     1145
     1146    /**
     1147     * Filter a specific site option before its value is updated.
     1148     *
     1149     * The dynamic portion of the hook name, $option, refers to the option name.
     1150     *
     1151     * @since 2.9.0 As 'pre_update_site_option_' . $key
     1152     * @since 3.0.0
     1153     *
     1154     * @param mixed $value     New value of site option.
     1155     * @param mixed $old_value Old value of site option.
     1156     */
    8761157    $value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value );
    8771158
     
    9041185
    9051186    if ( $result ) {
     1187
     1188        /**
     1189         * Fires after the value of a specific site option has been successfully updated.
     1190         *
     1191         * The dynamic portion of the hook name, $option, refers to the option name.
     1192         *
     1193         * @since 2.9.0 As "update_site_option_{$key}"
     1194         * @since 3.0.0
     1195         *
     1196         * @param string $option    Name of site option.
     1197         * @param mixed  $value     Current value of site option.
     1198         * @param mixed  $old_value Old value of site option.
     1199         */
    9061200        do_action( "update_site_option_{$option}", $option, $value, $old_value );
     1201
     1202        /**
     1203         * Fires after the value of a site option has been successfully updated.
     1204         *
     1205         * @since 3.0.0
     1206         *
     1207         * @param string $option    Name of site option.
     1208         * @param mixed  $value     Current value of site option.
     1209         * @param mixed  $old_value Old value of site option.
     1210         */
    9071211        do_action( "update_site_option", $option, $value, $old_value );
     1212
    9081213        return true;
    9091214    }
     
    9151220 *
    9161221 * @since 2.9.0
    917  *
    918  * @uses do_action() Calls 'delete_site_transient_$transient' hook before transient is deleted.
    919  * @uses do_action() Calls 'deleted_site_transient' hook on success.
    9201222 *
    9211223 * @param string $transient Transient name. Expected to not be SQL-escaped.
     
    9231225 */
    9241226function delete_site_transient( $transient ) {
     1227
     1228    /**
     1229     * Fires immediately before a specific site transient is deleted.
     1230     *
     1231     * The dynamic portion of the hook name, $transient, refers to the transient name.
     1232     *
     1233     * @since 3.0.0
     1234     *
     1235     * @param string $transient Transient name.
     1236     */
    9251237    do_action( 'delete_site_transient_' . $transient, $transient );
     1238
    9261239    if ( wp_using_ext_object_cache() ) {
    9271240        $result = wp_cache_delete( $transient, 'site-transient' );
     
    9331246            delete_site_option( $option_timeout );
    9341247    }
    935     if ( $result )
     1248    if ( $result ) {
     1249
     1250        /**
     1251         * Fires after a transient is deleted.
     1252         *
     1253         * @since 3.0.0
     1254         *
     1255         * @param string $transient Deleted transient name.
     1256         */
    9361257        do_action( 'deleted_site_transient', $transient );
     1258    }
     1259
    9371260    return $result;
    9381261}
     
    9441267 * will be false.
    9451268 *
     1269 * @since 2.9.0
     1270 *
    9461271 * @see get_transient()
    947  * @since 2.9.0
    948  *
    949  * @uses apply_filters() Calls 'pre_site_transient_$transient' hook before checking the transient.
    950  *  Any value other than false will "short-circuit" the retrieval of the transient
    951  *  and return the returned value.
    952  * @uses apply_filters() Calls 'site_transient_$option' hook, after checking the transient, with
    953  *  the transient value.
    9541272 *
    9551273 * @param string $transient Transient name. Expected to not be SQL-escaped.
     
    9571275 */
    9581276function get_site_transient( $transient ) {
     1277
     1278    /**
     1279     * Filter the value of an existing site transient.
     1280     *
     1281     * The dynamic portion of the hook name, $transient, refers to the transient name.
     1282     *
     1283     * Passing a truthy value to the filter will effectively short-circuit retrieval,
     1284     * returning the passed value instead.
     1285     *
     1286     * @since 2.9.0
     1287     *
     1288     * @param mixed $pre_site_transient The default value to return if the site transient does not exist.
     1289     *                                  Any value other than false will short-circuit the retrieval
     1290     *                                  of the transient, and return the returned value.
     1291     */
    9591292    $pre = apply_filters( 'pre_site_transient_' . $transient, false );
     1293
    9601294    if ( false !== $pre )
    9611295        return $pre;
     
    9811315    }
    9821316
     1317    /**
     1318     * Filter the value of an existing site transient.
     1319     *
     1320     * The dynamic portion of the hook name, $transient, refers to the transient name.
     1321     *
     1322     * @since 2.9.0
     1323     *
     1324     * @param mixed $value Value of site transient.
     1325     */
    9831326    return apply_filters( 'site_transient_' . $transient, $value );
    9841327}
     
    9901333 * it will be serialized before it is set.
    9911334 *
     1335 * @since 2.9.0
     1336 *
    9921337 * @see set_transient()
    993  * @since 2.9.0
    994  *
    995  * @uses apply_filters() Calls 'pre_set_site_transient_$transient' hook to allow overwriting the
    996  *  transient value to be stored.
    997  * @uses do_action() Calls 'set_site_transient_$transient' and 'setted_site_transient' hooks on success.
    9981338 *
    9991339 * @param string $transient Transient name. Expected to not be SQL-escaped.
     
    10031343 */
    10041344function set_site_transient( $transient, $value, $expiration = 0 ) {
     1345
     1346    /**
     1347     * Filter the value of a specific site transient before it is set.
     1348     *
     1349     * The dynamic portion of the hook name, $transient, refers to the transient name.
     1350     *
     1351     * @since 3.0.0
     1352     *
     1353     * @param mixed $value Value of site transient.
     1354     */
    10051355    $value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
     1356
    10061357    $expiration = (int) $expiration;
    10071358
     
    10221373    }
    10231374    if ( $result ) {
     1375
     1376        /**
     1377         * Fires after the value for a specific site transient has been set.
     1378         *
     1379         * The dynamic portion of the hook name, $transient, refers to the transient name.
     1380         *
     1381         * @since 3.0.0
     1382         *
     1383         * @param mixed $value      Site transient value.
     1384         * @param int   $expiration Time until expiration in seconds. Default 0.
     1385         */
    10241386        do_action( 'set_site_transient_' . $transient, $value, $expiration );
     1387
     1388        /**
     1389         * Fires after the value for a site transient has been set.
     1390         *
     1391         * @since 3.0.0
     1392         *
     1393         * @param string $transient  The name of the site transient.
     1394         * @param mixed  $value      Site transient value.
     1395         * @param int    $expiration Time until expiration in seconds. Default 0.
     1396         */
    10251397        do_action( 'setted_site_transient', $transient, $value, $expiration );
    10261398    }
Note: See TracChangeset for help on using the changeset viewer.