WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/option (option name)

Description

This hook allows you to filter any option after database lookup. The option_ hook follows the format "option_$option-name", where $option-name is the option you wish to filter.

Usage

For example, if you wanted to filter the blog description on archive pages. (i.e. How to take over the world. Page 2)


function my_theme_filter_blogdescription( $description ) {

	if ( ! is_archive() ) {
		return $description;
	}

	global $page, $paged;

	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
		$description .= $description . sprintf( __( ' Page %d' ), max( $paged, $page ) );
	}

	return $description;
}
add_filter( 'option_blogdescription', 'my_theme_filter_blogdescription' );

This is a common need to avoid duplicate meta description error in Google Webmaster Tools. As you can see in the above example I have targeted the option_blogdescription.


Source File

option_$option-name is located in wp-includes/option.php.