Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: option.php
[2000] Fix | Delete
/**
[2001] Fix | Delete
* Filters the value of a specific default network option.
[2002] Fix | Delete
*
[2003] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2004] Fix | Delete
*
[2005] Fix | Delete
* @since 3.4.0
[2006] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[2007] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2008] Fix | Delete
*
[2009] Fix | Delete
* @param mixed $default_value The value to return if the site option does not exist
[2010] Fix | Delete
* in the database.
[2011] Fix | Delete
* @param string $option Option name.
[2012] Fix | Delete
* @param int $network_id ID of the network.
[2013] Fix | Delete
*/
[2014] Fix | Delete
return apply_filters( "default_site_option_{$option}", $default_value, $option, $network_id );
[2015] Fix | Delete
}
[2016] Fix | Delete
[2017] Fix | Delete
if ( ! is_multisite() ) {
[2018] Fix | Delete
/** This filter is documented in wp-includes/option.php */
[2019] Fix | Delete
$default_value = apply_filters( 'default_site_option_' . $option, $default_value, $option, $network_id );
[2020] Fix | Delete
$value = get_option( $option, $default_value );
[2021] Fix | Delete
} else {
[2022] Fix | Delete
$cache_key = "$network_id:$option";
[2023] Fix | Delete
$value = wp_cache_get( $cache_key, 'site-options' );
[2024] Fix | Delete
[2025] Fix | Delete
if ( ! isset( $value ) || false === $value ) {
[2026] Fix | Delete
$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
[2027] Fix | Delete
[2028] Fix | Delete
// Has to be get_row() instead of get_var() because of funkiness with 0, false, null values.
[2029] Fix | Delete
if ( is_object( $row ) ) {
[2030] Fix | Delete
$value = $row->meta_value;
[2031] Fix | Delete
$value = maybe_unserialize( $value );
[2032] Fix | Delete
wp_cache_set( $cache_key, $value, 'site-options' );
[2033] Fix | Delete
} else {
[2034] Fix | Delete
if ( ! is_array( $notoptions ) ) {
[2035] Fix | Delete
$notoptions = array();
[2036] Fix | Delete
}
[2037] Fix | Delete
[2038] Fix | Delete
$notoptions[ $option ] = true;
[2039] Fix | Delete
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
[2040] Fix | Delete
[2041] Fix | Delete
/** This filter is documented in wp-includes/option.php */
[2042] Fix | Delete
$value = apply_filters( 'default_site_option_' . $option, $default_value, $option, $network_id );
[2043] Fix | Delete
}
[2044] Fix | Delete
}
[2045] Fix | Delete
}
[2046] Fix | Delete
[2047] Fix | Delete
if ( ! is_array( $notoptions ) ) {
[2048] Fix | Delete
$notoptions = array();
[2049] Fix | Delete
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
[2050] Fix | Delete
}
[2051] Fix | Delete
[2052] Fix | Delete
/**
[2053] Fix | Delete
* Filters the value of an existing network option.
[2054] Fix | Delete
*
[2055] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2056] Fix | Delete
*
[2057] Fix | Delete
* @since 2.9.0 As 'site_option_' . $key
[2058] Fix | Delete
* @since 3.0.0
[2059] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[2060] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2061] Fix | Delete
*
[2062] Fix | Delete
* @param mixed $value Value of network option.
[2063] Fix | Delete
* @param string $option Option name.
[2064] Fix | Delete
* @param int $network_id ID of the network.
[2065] Fix | Delete
*/
[2066] Fix | Delete
return apply_filters( "site_option_{$option}", $value, $option, $network_id );
[2067] Fix | Delete
}
[2068] Fix | Delete
[2069] Fix | Delete
/**
[2070] Fix | Delete
* Adds a new network option.
[2071] Fix | Delete
*
[2072] Fix | Delete
* Existing options will not be updated.
[2073] Fix | Delete
*
[2074] Fix | Delete
* @since 4.4.0
[2075] Fix | Delete
*
[2076] Fix | Delete
* @see add_option()
[2077] Fix | Delete
*
[2078] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[2079] Fix | Delete
*
[2080] Fix | Delete
* @param int $network_id ID of the network. Can be null to default to the current network ID.
[2081] Fix | Delete
* @param string $option Name of the option to add. Expected to not be SQL-escaped.
[2082] Fix | Delete
* @param mixed $value Option value, can be anything. Expected to not be SQL-escaped.
[2083] Fix | Delete
* @return bool True if the option was added, false otherwise.
[2084] Fix | Delete
*/
[2085] Fix | Delete
function add_network_option( $network_id, $option, $value ) {
[2086] Fix | Delete
global $wpdb;
[2087] Fix | Delete
[2088] Fix | Delete
if ( $network_id && ! is_numeric( $network_id ) ) {
[2089] Fix | Delete
return false;
[2090] Fix | Delete
}
[2091] Fix | Delete
[2092] Fix | Delete
$network_id = (int) $network_id;
[2093] Fix | Delete
[2094] Fix | Delete
// Fallback to the current network if a network ID is not specified.
[2095] Fix | Delete
if ( ! $network_id ) {
[2096] Fix | Delete
$network_id = get_current_network_id();
[2097] Fix | Delete
}
[2098] Fix | Delete
[2099] Fix | Delete
wp_protect_special_option( $option );
[2100] Fix | Delete
[2101] Fix | Delete
/**
[2102] Fix | Delete
* Filters the value of a specific network option before it is added.
[2103] Fix | Delete
*
[2104] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2105] Fix | Delete
*
[2106] Fix | Delete
* @since 2.9.0 As 'pre_add_site_option_' . $key
[2107] Fix | Delete
* @since 3.0.0
[2108] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[2109] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2110] Fix | Delete
*
[2111] Fix | Delete
* @param mixed $value Value of network option.
[2112] Fix | Delete
* @param string $option Option name.
[2113] Fix | Delete
* @param int $network_id ID of the network.
[2114] Fix | Delete
*/
[2115] Fix | Delete
$value = apply_filters( "pre_add_site_option_{$option}", $value, $option, $network_id );
[2116] Fix | Delete
[2117] Fix | Delete
$notoptions_key = "$network_id:notoptions";
[2118] Fix | Delete
[2119] Fix | Delete
if ( ! is_multisite() ) {
[2120] Fix | Delete
$result = add_option( $option, $value, '', false );
[2121] Fix | Delete
} else {
[2122] Fix | Delete
$cache_key = "$network_id:$option";
[2123] Fix | Delete
[2124] Fix | Delete
/*
[2125] Fix | Delete
* Make sure the option doesn't already exist.
[2126] Fix | Delete
* We can check the 'notoptions' cache before we ask for a DB query.
[2127] Fix | Delete
*/
[2128] Fix | Delete
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
[2129] Fix | Delete
[2130] Fix | Delete
if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) {
[2131] Fix | Delete
if ( false !== get_network_option( $network_id, $option, false ) ) {
[2132] Fix | Delete
return false;
[2133] Fix | Delete
}
[2134] Fix | Delete
}
[2135] Fix | Delete
[2136] Fix | Delete
$value = sanitize_option( $option, $value );
[2137] Fix | Delete
[2138] Fix | Delete
$serialized_value = maybe_serialize( $value );
[2139] Fix | Delete
$result = $wpdb->insert(
[2140] Fix | Delete
$wpdb->sitemeta,
[2141] Fix | Delete
array(
[2142] Fix | Delete
'site_id' => $network_id,
[2143] Fix | Delete
'meta_key' => $option,
[2144] Fix | Delete
'meta_value' => $serialized_value,
[2145] Fix | Delete
)
[2146] Fix | Delete
);
[2147] Fix | Delete
[2148] Fix | Delete
if ( ! $result ) {
[2149] Fix | Delete
return false;
[2150] Fix | Delete
}
[2151] Fix | Delete
[2152] Fix | Delete
wp_cache_set( $cache_key, $value, 'site-options' );
[2153] Fix | Delete
[2154] Fix | Delete
// This option exists now.
[2155] Fix | Delete
$notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // Yes, again... we need it to be fresh.
[2156] Fix | Delete
[2157] Fix | Delete
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
[2158] Fix | Delete
unset( $notoptions[ $option ] );
[2159] Fix | Delete
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
[2160] Fix | Delete
}
[2161] Fix | Delete
}
[2162] Fix | Delete
[2163] Fix | Delete
if ( $result ) {
[2164] Fix | Delete
[2165] Fix | Delete
/**
[2166] Fix | Delete
* Fires after a specific network option has been successfully added.
[2167] Fix | Delete
*
[2168] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2169] Fix | Delete
*
[2170] Fix | Delete
* @since 2.9.0 As "add_site_option_{$key}"
[2171] Fix | Delete
* @since 3.0.0
[2172] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2173] Fix | Delete
*
[2174] Fix | Delete
* @param string $option Name of the network option.
[2175] Fix | Delete
* @param mixed $value Value of the network option.
[2176] Fix | Delete
* @param int $network_id ID of the network.
[2177] Fix | Delete
*/
[2178] Fix | Delete
do_action( "add_site_option_{$option}", $option, $value, $network_id );
[2179] Fix | Delete
[2180] Fix | Delete
/**
[2181] Fix | Delete
* Fires after a network option has been successfully added.
[2182] Fix | Delete
*
[2183] Fix | Delete
* @since 3.0.0
[2184] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2185] Fix | Delete
*
[2186] Fix | Delete
* @param string $option Name of the network option.
[2187] Fix | Delete
* @param mixed $value Value of the network option.
[2188] Fix | Delete
* @param int $network_id ID of the network.
[2189] Fix | Delete
*/
[2190] Fix | Delete
do_action( 'add_site_option', $option, $value, $network_id );
[2191] Fix | Delete
[2192] Fix | Delete
return true;
[2193] Fix | Delete
}
[2194] Fix | Delete
[2195] Fix | Delete
return false;
[2196] Fix | Delete
}
[2197] Fix | Delete
[2198] Fix | Delete
/**
[2199] Fix | Delete
* Removes a network option by name.
[2200] Fix | Delete
*
[2201] Fix | Delete
* @since 4.4.0
[2202] Fix | Delete
*
[2203] Fix | Delete
* @see delete_option()
[2204] Fix | Delete
*
[2205] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[2206] Fix | Delete
*
[2207] Fix | Delete
* @param int $network_id ID of the network. Can be null to default to the current network ID.
[2208] Fix | Delete
* @param string $option Name of the option to delete. Expected to not be SQL-escaped.
[2209] Fix | Delete
* @return bool True if the option was deleted, false otherwise.
[2210] Fix | Delete
*/
[2211] Fix | Delete
function delete_network_option( $network_id, $option ) {
[2212] Fix | Delete
global $wpdb;
[2213] Fix | Delete
[2214] Fix | Delete
if ( $network_id && ! is_numeric( $network_id ) ) {
[2215] Fix | Delete
return false;
[2216] Fix | Delete
}
[2217] Fix | Delete
[2218] Fix | Delete
$network_id = (int) $network_id;
[2219] Fix | Delete
[2220] Fix | Delete
// Fallback to the current network if a network ID is not specified.
[2221] Fix | Delete
if ( ! $network_id ) {
[2222] Fix | Delete
$network_id = get_current_network_id();
[2223] Fix | Delete
}
[2224] Fix | Delete
[2225] Fix | Delete
/**
[2226] Fix | Delete
* Fires immediately before a specific network option is deleted.
[2227] Fix | Delete
*
[2228] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2229] Fix | Delete
*
[2230] Fix | Delete
* @since 3.0.0
[2231] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[2232] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2233] Fix | Delete
*
[2234] Fix | Delete
* @param string $option Option name.
[2235] Fix | Delete
* @param int $network_id ID of the network.
[2236] Fix | Delete
*/
[2237] Fix | Delete
do_action( "pre_delete_site_option_{$option}", $option, $network_id );
[2238] Fix | Delete
[2239] Fix | Delete
if ( ! is_multisite() ) {
[2240] Fix | Delete
$result = delete_option( $option );
[2241] Fix | Delete
} else {
[2242] Fix | Delete
$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
[2243] Fix | Delete
if ( is_null( $row ) || ! $row->meta_id ) {
[2244] Fix | Delete
return false;
[2245] Fix | Delete
}
[2246] Fix | Delete
$cache_key = "$network_id:$option";
[2247] Fix | Delete
wp_cache_delete( $cache_key, 'site-options' );
[2248] Fix | Delete
[2249] Fix | Delete
$result = $wpdb->delete(
[2250] Fix | Delete
$wpdb->sitemeta,
[2251] Fix | Delete
array(
[2252] Fix | Delete
'meta_key' => $option,
[2253] Fix | Delete
'site_id' => $network_id,
[2254] Fix | Delete
)
[2255] Fix | Delete
);
[2256] Fix | Delete
}
[2257] Fix | Delete
[2258] Fix | Delete
if ( $result ) {
[2259] Fix | Delete
[2260] Fix | Delete
/**
[2261] Fix | Delete
* Fires after a specific network option has been deleted.
[2262] Fix | Delete
*
[2263] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2264] Fix | Delete
*
[2265] Fix | Delete
* @since 2.9.0 As "delete_site_option_{$key}"
[2266] Fix | Delete
* @since 3.0.0
[2267] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2268] Fix | Delete
*
[2269] Fix | Delete
* @param string $option Name of the network option.
[2270] Fix | Delete
* @param int $network_id ID of the network.
[2271] Fix | Delete
*/
[2272] Fix | Delete
do_action( "delete_site_option_{$option}", $option, $network_id );
[2273] Fix | Delete
[2274] Fix | Delete
/**
[2275] Fix | Delete
* Fires after a network option has been deleted.
[2276] Fix | Delete
*
[2277] Fix | Delete
* @since 3.0.0
[2278] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2279] Fix | Delete
*
[2280] Fix | Delete
* @param string $option Name of the network option.
[2281] Fix | Delete
* @param int $network_id ID of the network.
[2282] Fix | Delete
*/
[2283] Fix | Delete
do_action( 'delete_site_option', $option, $network_id );
[2284] Fix | Delete
[2285] Fix | Delete
return true;
[2286] Fix | Delete
}
[2287] Fix | Delete
[2288] Fix | Delete
return false;
[2289] Fix | Delete
}
[2290] Fix | Delete
[2291] Fix | Delete
/**
[2292] Fix | Delete
* Updates the value of a network option that was already added.
[2293] Fix | Delete
*
[2294] Fix | Delete
* @since 4.4.0
[2295] Fix | Delete
*
[2296] Fix | Delete
* @see update_option()
[2297] Fix | Delete
*
[2298] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[2299] Fix | Delete
*
[2300] Fix | Delete
* @param int $network_id ID of the network. Can be null to default to the current network ID.
[2301] Fix | Delete
* @param string $option Name of the option. Expected to not be SQL-escaped.
[2302] Fix | Delete
* @param mixed $value Option value. Expected to not be SQL-escaped.
[2303] Fix | Delete
* @return bool True if the value was updated, false otherwise.
[2304] Fix | Delete
*/
[2305] Fix | Delete
function update_network_option( $network_id, $option, $value ) {
[2306] Fix | Delete
global $wpdb;
[2307] Fix | Delete
[2308] Fix | Delete
if ( $network_id && ! is_numeric( $network_id ) ) {
[2309] Fix | Delete
return false;
[2310] Fix | Delete
}
[2311] Fix | Delete
[2312] Fix | Delete
$network_id = (int) $network_id;
[2313] Fix | Delete
[2314] Fix | Delete
// Fallback to the current network if a network ID is not specified.
[2315] Fix | Delete
if ( ! $network_id ) {
[2316] Fix | Delete
$network_id = get_current_network_id();
[2317] Fix | Delete
}
[2318] Fix | Delete
[2319] Fix | Delete
wp_protect_special_option( $option );
[2320] Fix | Delete
[2321] Fix | Delete
$old_value = get_network_option( $network_id, $option );
[2322] Fix | Delete
[2323] Fix | Delete
/**
[2324] Fix | Delete
* Filters a specific network option before its value is updated.
[2325] Fix | Delete
*
[2326] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2327] Fix | Delete
*
[2328] Fix | Delete
* @since 2.9.0 As 'pre_update_site_option_' . $key
[2329] Fix | Delete
* @since 3.0.0
[2330] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[2331] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2332] Fix | Delete
*
[2333] Fix | Delete
* @param mixed $value New value of the network option.
[2334] Fix | Delete
* @param mixed $old_value Old value of the network option.
[2335] Fix | Delete
* @param string $option Option name.
[2336] Fix | Delete
* @param int $network_id ID of the network.
[2337] Fix | Delete
*/
[2338] Fix | Delete
$value = apply_filters( "pre_update_site_option_{$option}", $value, $old_value, $option, $network_id );
[2339] Fix | Delete
[2340] Fix | Delete
/*
[2341] Fix | Delete
* If the new and old values are the same, no need to update.
[2342] Fix | Delete
*
[2343] Fix | Delete
* Unserialized values will be adequate in most cases. If the unserialized
[2344] Fix | Delete
* data differs, the (maybe) serialized data is checked to avoid
[2345] Fix | Delete
* unnecessary database calls for otherwise identical object instances.
[2346] Fix | Delete
*
[2347] Fix | Delete
* See https://core.trac.wordpress.org/ticket/44956
[2348] Fix | Delete
*/
[2349] Fix | Delete
if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) {
[2350] Fix | Delete
return false;
[2351] Fix | Delete
}
[2352] Fix | Delete
[2353] Fix | Delete
if ( false === $old_value ) {
[2354] Fix | Delete
return add_network_option( $network_id, $option, $value );
[2355] Fix | Delete
}
[2356] Fix | Delete
[2357] Fix | Delete
$notoptions_key = "$network_id:notoptions";
[2358] Fix | Delete
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
[2359] Fix | Delete
[2360] Fix | Delete
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
[2361] Fix | Delete
unset( $notoptions[ $option ] );
[2362] Fix | Delete
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
[2363] Fix | Delete
}
[2364] Fix | Delete
[2365] Fix | Delete
if ( ! is_multisite() ) {
[2366] Fix | Delete
$result = update_option( $option, $value, false );
[2367] Fix | Delete
} else {
[2368] Fix | Delete
$value = sanitize_option( $option, $value );
[2369] Fix | Delete
[2370] Fix | Delete
$serialized_value = maybe_serialize( $value );
[2371] Fix | Delete
$result = $wpdb->update(
[2372] Fix | Delete
$wpdb->sitemeta,
[2373] Fix | Delete
array( 'meta_value' => $serialized_value ),
[2374] Fix | Delete
array(
[2375] Fix | Delete
'site_id' => $network_id,
[2376] Fix | Delete
'meta_key' => $option,
[2377] Fix | Delete
)
[2378] Fix | Delete
);
[2379] Fix | Delete
[2380] Fix | Delete
if ( $result ) {
[2381] Fix | Delete
$cache_key = "$network_id:$option";
[2382] Fix | Delete
wp_cache_set( $cache_key, $value, 'site-options' );
[2383] Fix | Delete
}
[2384] Fix | Delete
}
[2385] Fix | Delete
[2386] Fix | Delete
if ( $result ) {
[2387] Fix | Delete
[2388] Fix | Delete
/**
[2389] Fix | Delete
* Fires after the value of a specific network option has been successfully updated.
[2390] Fix | Delete
*
[2391] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[2392] Fix | Delete
*
[2393] Fix | Delete
* @since 2.9.0 As "update_site_option_{$key}"
[2394] Fix | Delete
* @since 3.0.0
[2395] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2396] Fix | Delete
*
[2397] Fix | Delete
* @param string $option Name of the network option.
[2398] Fix | Delete
* @param mixed $value Current value of the network option.
[2399] Fix | Delete
* @param mixed $old_value Old value of the network option.
[2400] Fix | Delete
* @param int $network_id ID of the network.
[2401] Fix | Delete
*/
[2402] Fix | Delete
do_action( "update_site_option_{$option}", $option, $value, $old_value, $network_id );
[2403] Fix | Delete
[2404] Fix | Delete
/**
[2405] Fix | Delete
* Fires after the value of a network option has been successfully updated.
[2406] Fix | Delete
*
[2407] Fix | Delete
* @since 3.0.0
[2408] Fix | Delete
* @since 4.7.0 The `$network_id` parameter was added.
[2409] Fix | Delete
*
[2410] Fix | Delete
* @param string $option Name of the network option.
[2411] Fix | Delete
* @param mixed $value Current value of the network option.
[2412] Fix | Delete
* @param mixed $old_value Old value of the network option.
[2413] Fix | Delete
* @param int $network_id ID of the network.
[2414] Fix | Delete
*/
[2415] Fix | Delete
do_action( 'update_site_option', $option, $value, $old_value, $network_id );
[2416] Fix | Delete
[2417] Fix | Delete
return true;
[2418] Fix | Delete
}
[2419] Fix | Delete
[2420] Fix | Delete
return false;
[2421] Fix | Delete
}
[2422] Fix | Delete
[2423] Fix | Delete
/**
[2424] Fix | Delete
* Deletes a site transient.
[2425] Fix | Delete
*
[2426] Fix | Delete
* @since 2.9.0
[2427] Fix | Delete
*
[2428] Fix | Delete
* @param string $transient Transient name. Expected to not be SQL-escaped.
[2429] Fix | Delete
* @return bool True if the transient was deleted, false otherwise.
[2430] Fix | Delete
*/
[2431] Fix | Delete
function delete_site_transient( $transient ) {
[2432] Fix | Delete
[2433] Fix | Delete
/**
[2434] Fix | Delete
* Fires immediately before a specific site transient is deleted.
[2435] Fix | Delete
*
[2436] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[2437] Fix | Delete
*
[2438] Fix | Delete
* @since 3.0.0
[2439] Fix | Delete
*
[2440] Fix | Delete
* @param string $transient Transient name.
[2441] Fix | Delete
*/
[2442] Fix | Delete
do_action( "delete_site_transient_{$transient}", $transient );
[2443] Fix | Delete
[2444] Fix | Delete
if ( wp_using_ext_object_cache() || wp_installing() ) {
[2445] Fix | Delete
$result = wp_cache_delete( $transient, 'site-transient' );
[2446] Fix | Delete
} else {
[2447] Fix | Delete
$option_timeout = '_site_transient_timeout_' . $transient;
[2448] Fix | Delete
$option = '_site_transient_' . $transient;
[2449] Fix | Delete
$result = delete_site_option( $option );
[2450] Fix | Delete
[2451] Fix | Delete
if ( $result ) {
[2452] Fix | Delete
delete_site_option( $option_timeout );
[2453] Fix | Delete
}
[2454] Fix | Delete
}
[2455] Fix | Delete
[2456] Fix | Delete
if ( $result ) {
[2457] Fix | Delete
[2458] Fix | Delete
/**
[2459] Fix | Delete
* Fires after a transient is deleted.
[2460] Fix | Delete
*
[2461] Fix | Delete
* @since 3.0.0
[2462] Fix | Delete
*
[2463] Fix | Delete
* @param string $transient Deleted transient name.
[2464] Fix | Delete
*/
[2465] Fix | Delete
do_action( 'deleted_site_transient', $transient );
[2466] Fix | Delete
}
[2467] Fix | Delete
[2468] Fix | Delete
return $result;
[2469] Fix | Delete
}
[2470] Fix | Delete
[2471] Fix | Delete
/**
[2472] Fix | Delete
* Retrieves the value of a site transient.
[2473] Fix | Delete
*
[2474] Fix | Delete
* If the transient does not exist, does not have a value, or has expired,
[2475] Fix | Delete
* then the return value will be false.
[2476] Fix | Delete
*
[2477] Fix | Delete
* @since 2.9.0
[2478] Fix | Delete
*
[2479] Fix | Delete
* @see get_transient()
[2480] Fix | Delete
*
[2481] Fix | Delete
* @param string $transient Transient name. Expected to not be SQL-escaped.
[2482] Fix | Delete
* @return mixed Value of transient.
[2483] Fix | Delete
*/
[2484] Fix | Delete
function get_site_transient( $transient ) {
[2485] Fix | Delete
[2486] Fix | Delete
/**
[2487] Fix | Delete
* Filters the value of an existing site transient before it is retrieved.
[2488] Fix | Delete
*
[2489] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[2490] Fix | Delete
*
[2491] Fix | Delete
* Returning a value other than boolean false will short-circuit retrieval and
[2492] Fix | Delete
* return that value instead.
[2493] Fix | Delete
*
[2494] Fix | Delete
* @since 2.9.0
[2495] Fix | Delete
* @since 4.4.0 The `$transient` parameter was added.
[2496] Fix | Delete
*
[2497] Fix | Delete
* @param mixed $pre_site_transient The default value to return if the site transient does not exist.
[2498] Fix | Delete
* Any value other than false will short-circuit the retrieval
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function