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/wp-inclu...
File: option.php
*
[500] Fix | Delete
* @param string[] $options List of option names. Expected to not be SQL-escaped.
[501] Fix | Delete
* @param string|bool $autoload Autoload value to control whether to load the options when WordPress starts up.
[502] Fix | Delete
* Accepts 'yes'|true to enable or 'no'|false to disable.
[503] Fix | Delete
* @return array Associative array of all provided $options as keys and boolean values for whether their autoload value
[504] Fix | Delete
* was updated.
[505] Fix | Delete
*/
[506] Fix | Delete
function wp_set_options_autoload( array $options, $autoload ) {
[507] Fix | Delete
return wp_set_option_autoload_values(
[508] Fix | Delete
array_fill_keys( $options, $autoload )
[509] Fix | Delete
);
[510] Fix | Delete
}
[511] Fix | Delete
[512] Fix | Delete
/**
[513] Fix | Delete
* Sets the autoload value for an option in the database.
[514] Fix | Delete
*
[515] Fix | Delete
* This is a wrapper for {@see wp_set_option_autoload_values()}, which can be used to set the autoload value for
[516] Fix | Delete
* multiple options at once.
[517] Fix | Delete
*
[518] Fix | Delete
* @since 6.4.0
[519] Fix | Delete
*
[520] Fix | Delete
* @see wp_set_option_autoload_values()
[521] Fix | Delete
*
[522] Fix | Delete
* @param string $option Name of the option. Expected to not be SQL-escaped.
[523] Fix | Delete
* @param string|bool $autoload Autoload value to control whether to load the option when WordPress starts up.
[524] Fix | Delete
* Accepts 'yes'|true to enable or 'no'|false to disable.
[525] Fix | Delete
* @return bool True if the autoload value was modified, false otherwise.
[526] Fix | Delete
*/
[527] Fix | Delete
function wp_set_option_autoload( $option, $autoload ) {
[528] Fix | Delete
$result = wp_set_option_autoload_values( array( $option => $autoload ) );
[529] Fix | Delete
if ( isset( $result[ $option ] ) ) {
[530] Fix | Delete
return $result[ $option ];
[531] Fix | Delete
}
[532] Fix | Delete
return false;
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
/**
[536] Fix | Delete
* Protects WordPress special option from being modified.
[537] Fix | Delete
*
[538] Fix | Delete
* Will die if $option is in protected list. Protected options are 'alloptions'
[539] Fix | Delete
* and 'notoptions' options.
[540] Fix | Delete
*
[541] Fix | Delete
* @since 2.2.0
[542] Fix | Delete
*
[543] Fix | Delete
* @param string $option Option name.
[544] Fix | Delete
*/
[545] Fix | Delete
function wp_protect_special_option( $option ) {
[546] Fix | Delete
if ( 'alloptions' === $option || 'notoptions' === $option ) {
[547] Fix | Delete
wp_die(
[548] Fix | Delete
sprintf(
[549] Fix | Delete
/* translators: %s: Option name. */
[550] Fix | Delete
__( '%s is a protected WP option and may not be modified' ),
[551] Fix | Delete
esc_html( $option )
[552] Fix | Delete
)
[553] Fix | Delete
);
[554] Fix | Delete
}
[555] Fix | Delete
}
[556] Fix | Delete
[557] Fix | Delete
/**
[558] Fix | Delete
* Prints option value after sanitizing for forms.
[559] Fix | Delete
*
[560] Fix | Delete
* @since 1.5.0
[561] Fix | Delete
*
[562] Fix | Delete
* @param string $option Option name.
[563] Fix | Delete
*/
[564] Fix | Delete
function form_option( $option ) {
[565] Fix | Delete
echo esc_attr( get_option( $option ) );
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
/**
[569] Fix | Delete
* Loads and caches all autoloaded options, if available or all options.
[570] Fix | Delete
*
[571] Fix | Delete
* @since 2.2.0
[572] Fix | Delete
* @since 5.3.1 The `$force_cache` parameter was added.
[573] Fix | Delete
*
[574] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[575] Fix | Delete
*
[576] Fix | Delete
* @param bool $force_cache Optional. Whether to force an update of the local cache
[577] Fix | Delete
* from the persistent cache. Default false.
[578] Fix | Delete
* @return array List of all options.
[579] Fix | Delete
*/
[580] Fix | Delete
function wp_load_alloptions( $force_cache = false ) {
[581] Fix | Delete
global $wpdb;
[582] Fix | Delete
[583] Fix | Delete
/**
[584] Fix | Delete
* Filters the array of alloptions before it is populated.
[585] Fix | Delete
*
[586] Fix | Delete
* Returning an array from the filter will effectively short circuit
[587] Fix | Delete
* wp_load_alloptions(), returning that value instead.
[588] Fix | Delete
*
[589] Fix | Delete
* @since 6.2.0
[590] Fix | Delete
*
[591] Fix | Delete
* @param array|null $alloptions An array of alloptions. Default null.
[592] Fix | Delete
* @param bool $force_cache Whether to force an update of the local cache from the persistent cache. Default false.
[593] Fix | Delete
*/
[594] Fix | Delete
$alloptions = apply_filters( 'pre_wp_load_alloptions', null, $force_cache );
[595] Fix | Delete
if ( is_array( $alloptions ) ) {
[596] Fix | Delete
return $alloptions;
[597] Fix | Delete
}
[598] Fix | Delete
[599] Fix | Delete
if ( ! wp_installing() || ! is_multisite() ) {
[600] Fix | Delete
$alloptions = wp_cache_get( 'alloptions', 'options', $force_cache );
[601] Fix | Delete
} else {
[602] Fix | Delete
$alloptions = false;
[603] Fix | Delete
}
[604] Fix | Delete
[605] Fix | Delete
if ( ! $alloptions ) {
[606] Fix | Delete
$suppress = $wpdb->suppress_errors();
[607] Fix | Delete
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload IN ( '" . implode( "', '", esc_sql( wp_autoload_values_to_autoload() ) ) . "' )" );
[608] Fix | Delete
[609] Fix | Delete
if ( ! $alloptions_db ) {
[610] Fix | Delete
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
[611] Fix | Delete
}
[612] Fix | Delete
$wpdb->suppress_errors( $suppress );
[613] Fix | Delete
[614] Fix | Delete
$alloptions = array();
[615] Fix | Delete
foreach ( (array) $alloptions_db as $o ) {
[616] Fix | Delete
$alloptions[ $o->option_name ] = $o->option_value;
[617] Fix | Delete
}
[618] Fix | Delete
[619] Fix | Delete
if ( ! wp_installing() || ! is_multisite() ) {
[620] Fix | Delete
/**
[621] Fix | Delete
* Filters all options before caching them.
[622] Fix | Delete
*
[623] Fix | Delete
* @since 4.9.0
[624] Fix | Delete
*
[625] Fix | Delete
* @param array $alloptions Array with all options.
[626] Fix | Delete
*/
[627] Fix | Delete
$alloptions = apply_filters( 'pre_cache_alloptions', $alloptions );
[628] Fix | Delete
[629] Fix | Delete
wp_cache_add( 'alloptions', $alloptions, 'options' );
[630] Fix | Delete
}
[631] Fix | Delete
}
[632] Fix | Delete
[633] Fix | Delete
/**
[634] Fix | Delete
* Filters all options after retrieving them.
[635] Fix | Delete
*
[636] Fix | Delete
* @since 4.9.0
[637] Fix | Delete
*
[638] Fix | Delete
* @param array $alloptions Array with all options.
[639] Fix | Delete
*/
[640] Fix | Delete
return apply_filters( 'alloptions', $alloptions );
[641] Fix | Delete
}
[642] Fix | Delete
[643] Fix | Delete
/**
[644] Fix | Delete
* Primes specific network options for the current network into the cache with a single database query.
[645] Fix | Delete
*
[646] Fix | Delete
* Only network options that do not already exist in cache will be loaded.
[647] Fix | Delete
*
[648] Fix | Delete
* If site is not multisite, then call wp_prime_option_caches().
[649] Fix | Delete
*
[650] Fix | Delete
* @since 6.6.0
[651] Fix | Delete
*
[652] Fix | Delete
* @see wp_prime_network_option_caches()
[653] Fix | Delete
*
[654] Fix | Delete
* @param string[] $options An array of option names to be loaded.
[655] Fix | Delete
*/
[656] Fix | Delete
function wp_prime_site_option_caches( array $options ) {
[657] Fix | Delete
wp_prime_network_option_caches( null, $options );
[658] Fix | Delete
}
[659] Fix | Delete
[660] Fix | Delete
/**
[661] Fix | Delete
* Primes specific network options into the cache with a single database query.
[662] Fix | Delete
*
[663] Fix | Delete
* Only network options that do not already exist in cache will be loaded.
[664] Fix | Delete
*
[665] Fix | Delete
* If site is not multisite, then call wp_prime_option_caches().
[666] Fix | Delete
*
[667] Fix | Delete
* @since 6.6.0
[668] Fix | Delete
*
[669] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[670] Fix | Delete
*
[671] Fix | Delete
* @param int $network_id ID of the network. Can be null to default to the current network ID.
[672] Fix | Delete
* @param string[] $options An array of option names to be loaded.
[673] Fix | Delete
*/
[674] Fix | Delete
function wp_prime_network_option_caches( $network_id, array $options ) {
[675] Fix | Delete
global $wpdb;
[676] Fix | Delete
[677] Fix | Delete
if ( wp_installing() ) {
[678] Fix | Delete
return;
[679] Fix | Delete
}
[680] Fix | Delete
[681] Fix | Delete
if ( ! is_multisite() ) {
[682] Fix | Delete
wp_prime_option_caches( $options );
[683] Fix | Delete
return;
[684] Fix | Delete
}
[685] Fix | Delete
[686] Fix | Delete
if ( $network_id && ! is_numeric( $network_id ) ) {
[687] Fix | Delete
return;
[688] Fix | Delete
}
[689] Fix | Delete
[690] Fix | Delete
$network_id = (int) $network_id;
[691] Fix | Delete
[692] Fix | Delete
// Fallback to the current network if a network ID is not specified.
[693] Fix | Delete
if ( ! $network_id ) {
[694] Fix | Delete
$network_id = get_current_network_id();
[695] Fix | Delete
}
[696] Fix | Delete
[697] Fix | Delete
$cache_keys = array();
[698] Fix | Delete
foreach ( $options as $option ) {
[699] Fix | Delete
$cache_keys[ $option ] = "{$network_id}:{$option}";
[700] Fix | Delete
}
[701] Fix | Delete
[702] Fix | Delete
$cache_group = 'site-options';
[703] Fix | Delete
$cached_options = wp_cache_get_multiple( array_values( $cache_keys ), $cache_group );
[704] Fix | Delete
[705] Fix | Delete
$notoptions_key = "$network_id:notoptions";
[706] Fix | Delete
$notoptions = wp_cache_get( $notoptions_key, $cache_group );
[707] Fix | Delete
[708] Fix | Delete
if ( ! is_array( $notoptions ) ) {
[709] Fix | Delete
$notoptions = array();
[710] Fix | Delete
}
[711] Fix | Delete
[712] Fix | Delete
// Filter options that are not in the cache.
[713] Fix | Delete
$options_to_prime = array();
[714] Fix | Delete
foreach ( $cache_keys as $option => $cache_key ) {
[715] Fix | Delete
if (
[716] Fix | Delete
( ! isset( $cached_options[ $cache_key ] ) || false === $cached_options[ $cache_key ] )
[717] Fix | Delete
&& ! isset( $notoptions[ $option ] )
[718] Fix | Delete
) {
[719] Fix | Delete
$options_to_prime[] = $option;
[720] Fix | Delete
}
[721] Fix | Delete
}
[722] Fix | Delete
[723] Fix | Delete
// Bail early if there are no options to be loaded.
[724] Fix | Delete
if ( empty( $options_to_prime ) ) {
[725] Fix | Delete
return;
[726] Fix | Delete
}
[727] Fix | Delete
[728] Fix | Delete
$query_args = $options_to_prime;
[729] Fix | Delete
$query_args[] = $network_id;
[730] Fix | Delete
$results = $wpdb->get_results(
[731] Fix | Delete
$wpdb->prepare(
[732] Fix | Delete
sprintf(
[733] Fix | Delete
"SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN (%s) AND site_id = %s",
[734] Fix | Delete
implode( ',', array_fill( 0, count( $options_to_prime ), '%s' ) ),
[735] Fix | Delete
'%d'
[736] Fix | Delete
),
[737] Fix | Delete
$query_args
[738] Fix | Delete
)
[739] Fix | Delete
);
[740] Fix | Delete
[741] Fix | Delete
$data = array();
[742] Fix | Delete
$options_found = array();
[743] Fix | Delete
foreach ( $results as $result ) {
[744] Fix | Delete
$key = $result->meta_key;
[745] Fix | Delete
$cache_key = $cache_keys[ $key ];
[746] Fix | Delete
$data[ $cache_key ] = maybe_unserialize( $result->meta_value );
[747] Fix | Delete
$options_found[] = $key;
[748] Fix | Delete
}
[749] Fix | Delete
wp_cache_set_multiple( $data, $cache_group );
[750] Fix | Delete
// If all options were found, no need to update `notoptions` cache.
[751] Fix | Delete
if ( count( $options_found ) === count( $options_to_prime ) ) {
[752] Fix | Delete
return;
[753] Fix | Delete
}
[754] Fix | Delete
[755] Fix | Delete
$options_not_found = array_diff( $options_to_prime, $options_found );
[756] Fix | Delete
[757] Fix | Delete
// Add the options that were not found to the cache.
[758] Fix | Delete
$update_notoptions = false;
[759] Fix | Delete
foreach ( $options_not_found as $option_name ) {
[760] Fix | Delete
if ( ! isset( $notoptions[ $option_name ] ) ) {
[761] Fix | Delete
$notoptions[ $option_name ] = true;
[762] Fix | Delete
$update_notoptions = true;
[763] Fix | Delete
}
[764] Fix | Delete
}
[765] Fix | Delete
[766] Fix | Delete
// Only update the cache if it was modified.
[767] Fix | Delete
if ( $update_notoptions ) {
[768] Fix | Delete
wp_cache_set( $notoptions_key, $notoptions, $cache_group );
[769] Fix | Delete
}
[770] Fix | Delete
}
[771] Fix | Delete
[772] Fix | Delete
/**
[773] Fix | Delete
* Loads and primes caches of certain often requested network options if is_multisite().
[774] Fix | Delete
*
[775] Fix | Delete
* @since 3.0.0
[776] Fix | Delete
* @since 6.3.0 Also prime caches for network options when persistent object cache is enabled.
[777] Fix | Delete
* @since 6.6.0 Uses wp_prime_network_option_caches().
[778] Fix | Delete
*
[779] Fix | Delete
* @param int $network_id Optional. Network ID of network for which to prime network options cache. Defaults to current network.
[780] Fix | Delete
*/
[781] Fix | Delete
function wp_load_core_site_options( $network_id = null ) {
[782] Fix | Delete
if ( ! is_multisite() || wp_installing() ) {
[783] Fix | Delete
return;
[784] Fix | Delete
}
[785] Fix | Delete
$core_options = array( 'site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting', 'WPLANG' );
[786] Fix | Delete
[787] Fix | Delete
wp_prime_network_option_caches( $network_id, $core_options );
[788] Fix | Delete
}
[789] Fix | Delete
[790] Fix | Delete
/**
[791] Fix | Delete
* Updates the value of an option that was already added.
[792] Fix | Delete
*
[793] Fix | Delete
* You do not need to serialize values. If the value needs to be serialized,
[794] Fix | Delete
* then it will be serialized before it is inserted into the database.
[795] Fix | Delete
* Remember, resources cannot be serialized or added as an option.
[796] Fix | Delete
*
[797] Fix | Delete
* If the option does not exist, it will be created.
[798] Fix | Delete
[799] Fix | Delete
* This function is designed to work with or without a logged-in user. In terms of security,
[800] Fix | Delete
* plugin developers should check the current user's capabilities before updating any options.
[801] Fix | Delete
*
[802] Fix | Delete
* @since 1.0.0
[803] Fix | Delete
* @since 4.2.0 The `$autoload` parameter was added.
[804] Fix | Delete
*
[805] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[806] Fix | Delete
*
[807] Fix | Delete
* @param string $option Name of the option to update. Expected to not be SQL-escaped.
[808] Fix | Delete
* @param mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
[809] Fix | Delete
* @param bool|null $autoload Optional. Whether to load the option when WordPress starts up.
[810] Fix | Delete
* Accepts a boolean, or `null` to stick with the initial value or, if no initial value is set,
[811] Fix | Delete
* to leave the decision up to default heuristics in WordPress.
[812] Fix | Delete
* For existing options,
[813] Fix | Delete
* `$autoload` can only be updated using `update_option()` if `$value` is also changed.
[814] Fix | Delete
* For backward compatibility 'yes' and 'no' are also accepted.
[815] Fix | Delete
* Autoloading too many options can lead to performance problems, especially if the
[816] Fix | Delete
* options are not frequently used. For options which are accessed across several places
[817] Fix | Delete
* in the frontend, it is recommended to autoload them, by using true.
[818] Fix | Delete
* For options which are accessed only on few specific URLs, it is recommended
[819] Fix | Delete
* to not autoload them, by using false.
[820] Fix | Delete
* For non-existent options, the default is null, which means WordPress will determine
[821] Fix | Delete
* the autoload value.
[822] Fix | Delete
* @return bool True if the value was updated, false otherwise.
[823] Fix | Delete
*/
[824] Fix | Delete
function update_option( $option, $value, $autoload = null ) {
[825] Fix | Delete
global $wpdb;
[826] Fix | Delete
[827] Fix | Delete
if ( is_scalar( $option ) ) {
[828] Fix | Delete
$option = trim( $option );
[829] Fix | Delete
}
[830] Fix | Delete
[831] Fix | Delete
if ( empty( $option ) ) {
[832] Fix | Delete
return false;
[833] Fix | Delete
}
[834] Fix | Delete
[835] Fix | Delete
/*
[836] Fix | Delete
* Until a proper _deprecated_option() function can be introduced,
[837] Fix | Delete
* redirect requests to deprecated keys to the new, correct ones.
[838] Fix | Delete
*/
[839] Fix | Delete
$deprecated_keys = array(
[840] Fix | Delete
'blacklist_keys' => 'disallowed_keys',
[841] Fix | Delete
'comment_whitelist' => 'comment_previously_approved',
[842] Fix | Delete
);
[843] Fix | Delete
[844] Fix | Delete
if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) {
[845] Fix | Delete
_deprecated_argument(
[846] Fix | Delete
__FUNCTION__,
[847] Fix | Delete
'5.5.0',
[848] Fix | Delete
sprintf(
[849] Fix | Delete
/* translators: 1: Deprecated option key, 2: New option key. */
[850] Fix | Delete
__( 'The "%1$s" option key has been renamed to "%2$s".' ),
[851] Fix | Delete
$option,
[852] Fix | Delete
$deprecated_keys[ $option ]
[853] Fix | Delete
)
[854] Fix | Delete
);
[855] Fix | Delete
return update_option( $deprecated_keys[ $option ], $value, $autoload );
[856] Fix | Delete
}
[857] Fix | Delete
[858] Fix | Delete
wp_protect_special_option( $option );
[859] Fix | Delete
[860] Fix | Delete
if ( is_object( $value ) ) {
[861] Fix | Delete
$value = clone $value;
[862] Fix | Delete
}
[863] Fix | Delete
[864] Fix | Delete
$value = sanitize_option( $option, $value );
[865] Fix | Delete
$old_value = get_option( $option );
[866] Fix | Delete
[867] Fix | Delete
/**
[868] Fix | Delete
* Filters a specific option before its value is (maybe) serialized and updated.
[869] Fix | Delete
*
[870] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[871] Fix | Delete
*
[872] Fix | Delete
* @since 2.6.0
[873] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[874] Fix | Delete
*
[875] Fix | Delete
* @param mixed $value The new, unserialized option value.
[876] Fix | Delete
* @param mixed $old_value The old option value.
[877] Fix | Delete
* @param string $option Option name.
[878] Fix | Delete
*/
[879] Fix | Delete
$value = apply_filters( "pre_update_option_{$option}", $value, $old_value, $option );
[880] Fix | Delete
[881] Fix | Delete
/**
[882] Fix | Delete
* Filters an option before its value is (maybe) serialized and updated.
[883] Fix | Delete
*
[884] Fix | Delete
* @since 3.9.0
[885] Fix | Delete
*
[886] Fix | Delete
* @param mixed $value The new, unserialized option value.
[887] Fix | Delete
* @param string $option Name of the option.
[888] Fix | Delete
* @param mixed $old_value The old option value.
[889] Fix | Delete
*/
[890] Fix | Delete
$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
[891] Fix | Delete
[892] Fix | Delete
/*
[893] Fix | Delete
* If the new and old values are the same, no need to update.
[894] Fix | Delete
*
[895] Fix | Delete
* Unserialized values will be adequate in most cases. If the unserialized
[896] Fix | Delete
* data differs, the (maybe) serialized data is checked to avoid
[897] Fix | Delete
* unnecessary database calls for otherwise identical object instances.
[898] Fix | Delete
*
[899] Fix | Delete
* See https://core.trac.wordpress.org/ticket/38903
[900] Fix | Delete
*/
[901] Fix | Delete
if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) {
[902] Fix | Delete
return false;
[903] Fix | Delete
}
[904] Fix | Delete
[905] Fix | Delete
/** This filter is documented in wp-includes/option.php */
[906] Fix | Delete
if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) {
[907] Fix | Delete
return add_option( $option, $value, '', $autoload );
[908] Fix | Delete
}
[909] Fix | Delete
[910] Fix | Delete
$serialized_value = maybe_serialize( $value );
[911] Fix | Delete
[912] Fix | Delete
/**
[913] Fix | Delete
* Fires immediately before an option value is updated.
[914] Fix | Delete
*
[915] Fix | Delete
* @since 2.9.0
[916] Fix | Delete
*
[917] Fix | Delete
* @param string $option Name of the option to update.
[918] Fix | Delete
* @param mixed $old_value The old option value.
[919] Fix | Delete
* @param mixed $value The new option value.
[920] Fix | Delete
*/
[921] Fix | Delete
do_action( 'update_option', $option, $old_value, $value );
[922] Fix | Delete
[923] Fix | Delete
$update_args = array(
[924] Fix | Delete
'option_value' => $serialized_value,
[925] Fix | Delete
);
[926] Fix | Delete
[927] Fix | Delete
if ( null !== $autoload ) {
[928] Fix | Delete
$update_args['autoload'] = wp_determine_option_autoload_value( $option, $value, $serialized_value, $autoload );
[929] Fix | Delete
} else {
[930] Fix | Delete
// Retrieve the current autoload value to reevaluate it in case it was set automatically.
[931] Fix | Delete
$raw_autoload = $wpdb->get_var( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
[932] Fix | Delete
$allow_values = array( 'auto-on', 'auto-off', 'auto' );
[933] Fix | Delete
if ( in_array( $raw_autoload, $allow_values, true ) ) {
[934] Fix | Delete
$autoload = wp_determine_option_autoload_value( $option, $value, $serialized_value, $autoload );
[935] Fix | Delete
if ( $autoload !== $raw_autoload ) {
[936] Fix | Delete
$update_args['autoload'] = $autoload;
[937] Fix | Delete
}
[938] Fix | Delete
}
[939] Fix | Delete
}
[940] Fix | Delete
[941] Fix | Delete
$result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) );
[942] Fix | Delete
if ( ! $result ) {
[943] Fix | Delete
return false;
[944] Fix | Delete
}
[945] Fix | Delete
[946] Fix | Delete
$notoptions = wp_cache_get( 'notoptions', 'options' );
[947] Fix | Delete
[948] Fix | Delete
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
[949] Fix | Delete
unset( $notoptions[ $option ] );
[950] Fix | Delete
wp_cache_set( 'notoptions', $notoptions, 'options' );
[951] Fix | Delete
}
[952] Fix | Delete
[953] Fix | Delete
if ( ! wp_installing() ) {
[954] Fix | Delete
if ( ! isset( $update_args['autoload'] ) ) {
[955] Fix | Delete
// Update the cached value based on where it is currently cached.
[956] Fix | Delete
$alloptions = wp_load_alloptions( true );
[957] Fix | Delete
[958] Fix | Delete
if ( isset( $alloptions[ $option ] ) ) {
[959] Fix | Delete
$alloptions[ $option ] = $serialized_value;
[960] Fix | Delete
wp_cache_set( 'alloptions', $alloptions, 'options' );
[961] Fix | Delete
} else {
[962] Fix | Delete
wp_cache_set( $option, $serialized_value, 'options' );
[963] Fix | Delete
}
[964] Fix | Delete
} elseif ( in_array( $update_args['autoload'], wp_autoload_values_to_autoload(), true ) ) {
[965] Fix | Delete
// Delete the individual cache, then set in alloptions cache.
[966] Fix | Delete
wp_cache_delete( $option, 'options' );
[967] Fix | Delete
[968] Fix | Delete
$alloptions = wp_load_alloptions( true );
[969] Fix | Delete
[970] Fix | Delete
$alloptions[ $option ] = $serialized_value;
[971] Fix | Delete
wp_cache_set( 'alloptions', $alloptions, 'options' );
[972] Fix | Delete
} else {
[973] Fix | Delete
// Delete the alloptions cache, then set the individual cache.
[974] Fix | Delete
$alloptions = wp_load_alloptions( true );
[975] Fix | Delete
[976] Fix | Delete
if ( isset( $alloptions[ $option ] ) ) {
[977] Fix | Delete
unset( $alloptions[ $option ] );
[978] Fix | Delete
wp_cache_set( 'alloptions', $alloptions, 'options' );
[979] Fix | Delete
}
[980] Fix | Delete
[981] Fix | Delete
wp_cache_set( $option, $serialized_value, 'options' );
[982] Fix | Delete
}
[983] Fix | Delete
}
[984] Fix | Delete
[985] Fix | Delete
/**
[986] Fix | Delete
* Fires after the value of a specific option has been successfully updated.
[987] Fix | Delete
*
[988] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[989] Fix | Delete
*
[990] Fix | Delete
* @since 2.0.1
[991] Fix | Delete
* @since 4.4.0 The `$option` parameter was added.
[992] Fix | Delete
*
[993] Fix | Delete
* @param mixed $old_value The old option value.
[994] Fix | Delete
* @param mixed $value The new option value.
[995] Fix | Delete
* @param string $option Option name.
[996] Fix | Delete
*/
[997] Fix | Delete
do_action( "update_option_{$option}", $old_value, $value, $option );
[998] Fix | Delete
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function