Action hook 'add_site_option_{$option}'

in WP Core File wp-includes/option.php at line 2228

View Source

add_site_option_{$option}

Action Hook
Description
Fires after a specific network option has been successfully added. The dynamic portion of the hook name, `$option`, refers to the option name.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Action
Line Number 2228

Hook Parameters

Type Name Description
string $option Name of the network option.
mixed $value Value of the network option.
int $network_id ID of the network.

Usage Examples

Basic Usage
<?php
// Hook into add_site_option_{$option}
add_action('add_site_option_{$option}', 'my_custom_function', 10, 3);

function my_custom_function($option, $value, $network_id) {
    // Your custom code here
}

Source Code Context

wp-includes/option.php:2228 - How this hook is used in WordPress core
<?php
2223  		 *
2224  		 * @param string $option     Name of the network option.
2225  		 * @param mixed  $value      Value of the network option.
2226  		 * @param int    $network_id ID of the network.
2227  		 */
2228  		do_action( "add_site_option_{$option}", $option, $value, $network_id );
2229  
2230  		/**
2231  		 * Fires after a network option has been successfully added.
2232  		 *
2233  		 * @since 3.0.0

PHP Documentation

<?php
/**
		 * Fires after a specific network option has been successfully added.
		 *
		 * The dynamic portion of the hook name, `$option`, refers to the option name.
		 *
		 * @since 2.9.0 As "add_site_option_{$key}"
		 * @since 3.0.0
		 * @since 4.7.0 The `$network_id` parameter was added.
		 *
		 * @param string $option     Name of the network option.
		 * @param mixed  $value      Value of the network option.
		 * @param int    $network_id ID of the network.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.