wppaste
WordPress

apply_filters( "pre_add_site_option_{$option}", mixed $value, string $option, int $network_id )

Since
2.9.0, 3.0.0, 4.4.0, 4.7.0
Filters the value of a specific network option before it is added.

Description

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

Compatibility

WordPress
since 4.7.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$valuemixed
Value of network option.
$optionstring
Option name.
$network_idint
ID of the network.

Where this hook fires · 1

  • wp-includes/option.php:2184add_network_option()

Source code

	 * @since 4.7.0 The `$network_id` parameter was added.	 *	 * @param mixed  $value      Value of network option.	 * @param string $option     Option name.	 * @param int    $network_id ID of the network.	 */	$value = apply_filters( "pre_add_site_option_{$option}", $value, $option, $network_id ); 	$notoptions_key = "$network_id:notoptions"; 	if ( ! is_multisite() ) {		$result = add_option( $option, $value, '', false );	} else {

Changelog

Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.7.0
The $network_id parameter was added.from the docblock
4.4.0
The $option parameter was added.from the docblock
3.0.0
from the docblock
2.9.0
As pre_add_site_option_{$key}.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.