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