WP_Customize_Widgets::capture_filter_pre_get_option() WordPress Method

The WP_Customize_Widgets::capture_filter_pre_get_option() method is used to capture the output of the WordPress filter pre_get_option and return it as a string. This is useful for customizing the output of WordPress widgets.

WP_Customize_Widgets::capture_filter_pre_get_option( mixed $value ) #

Pre-filters captured option values before retrieving.


Parameters

$value

(mixed)(Required)Value to return instead of the option value.


Top ↑

Return

(mixed) Filtered option value.


Top ↑

Source

File: wp-includes/class-wp-customize-widgets.php

	public function capture_filter_pre_get_option( $value ) {
		$option_name = preg_replace( '/^pre_option_/', '', current_filter() );

		if ( isset( $this->_captured_options[ $option_name ] ) ) {
			$value = $this->_captured_options[ $option_name ];

			/** This filter is documented in wp-includes/option.php */
			$value = apply_filters( 'option_' . $option_name, $value, $option_name );
		}

		return $value;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More