update_option_(option) хук-событиеWP 2.0.1

Fires after the value of a specific option has been successfully updated.

The dynamic portion of the hook name, $option, refers to the option name.

Использование

add_action( 'update_option_(option)', 'wp_kama_update_option_action', 10, 3 );

/**
 * Function for `update_option_(option)` action-hook.
 * 
 * @param mixed  $old_value The old option value.
 * @param mixed  $value     The new option value.
 * @param string $option    Option name.
 *
 * @return void
 */
function wp_kama_update_option_action( $old_value, $value, $option ){

	// action...
}
$old_value(разное)
The old option value.
$value(разное)
The new option value.
$option(строка)
Option name.

Список изменений

С версии 2.0.1 Введена.
С версии 4.4.0 The $option parameter was added.

Где вызывается хук

update_option()
update_option_(option)
wp-includes/option.php 554
do_action( "update_option_{$option}", $old_value, $value, $option );

Где используется хук в WordPress

wp-admin/includes/admin-filters.php 70
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
wp-admin/includes/admin-filters.php 71
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
wp-admin/includes/admin-filters.php 72
add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
wp-admin/includes/admin-filters.php 73
add_action( 'update_option_admin_email', 'wp_site_admin_email_change_notification', 10, 3 );
wp-admin/includes/admin-filters.php 76
add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
wp-includes/blocks/site-logo.php 180
add_action( "update_option_theme_mods_$theme", '_delete_site_logo_on_remove_custom_logo', 10, 2 );
wp-includes/default-filters.php 390
add_action( 'update_option_home', 'wp_update_https_migration_required', 10, 2 );
wp-includes/default-filters.php 530
add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
wp-includes/default-filters.php 531
add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
wp-includes/ms-default-filters.php 124
add_action( 'update_option_blogname', 'clean_site_details_cache', 10, 0 );
wp-includes/ms-default-filters.php 125
add_action( 'update_option_siteurl', 'clean_site_details_cache', 10, 0 );
wp-includes/ms-default-filters.php 126
add_action( 'update_option_post_count', 'clean_site_details_cache', 10, 0 );
wp-includes/ms-default-filters.php 127
add_action( 'update_option_home', 'clean_site_details_cache', 10, 0 );
wp-includes/ms-default-filters.php 19
add_action( 'update_option_blog_public', 'update_blog_public', 10, 2 );
wp-includes/update.php 1099
add_action( 'update_option_WPLANG', 'wp_clean_update_cache', 10, 0 );