apply_filters( "option_{$option}", mixed $value, string $option )

Filters the value of an existing option.


Description Description

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


Parameters Parameters

$value

(mixed) Value of the option. If stored serialized, it will be unserialized prior to being returned.

$option

(string) Option name.


Top ↑

Source Source

File: wp-includes/option.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 The $option parameter was added.
3.0.0
1.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by ptasker

    Quick tip for disabling a plugin at run time using the ‘active_plugins’ option:

    // Outputs an array of all plugins.
     var_dump( get_option( 'active_plugins' ) );
    
     add_filter( 'option_active_plugins', function( $plugins ){
    	if ( $my_condition ) {
    		unset( $plugins['my-plugin-slug'] );
    	}
    	return $plugins;
    });
    
    // Outputs an empty array.
    var_dump( get_option( 'active_plugins' ) );
    

You must log in before being able to contribute a note or feedback.