WP_Customize_Custom_CSS_Setting::filter_previewed_wp_get_custom_css() WordPress Method

The WP_Customize_Custom_CSS_Setting::filter_previewed_wp_get_custom_css() method is used to filter the previewed Custom CSS code. This is useful if you want to add or remove CSS code from the Custom CSS code that is being previewed.

WP_Customize_Custom_CSS_Setting::filter_previewed_wp_get_custom_css( string $css, string $stylesheet ) #

Filters wp_get_custom_css for applying the customized value.


Description

This is used in the preview when wp_get_custom_css() is called for rendering the styles.

Top ↑

See also


Top ↑

Parameters

$css

(string)(Required)Original CSS.

$stylesheet

(string)(Required)Current stylesheet.


Top ↑

Return

(string) CSS.


Top ↑

Source

File: wp-includes/customize/class-wp-customize-custom-css-setting.php

	public function filter_previewed_wp_get_custom_css( $css, $stylesheet ) {
		if ( $stylesheet === $this->stylesheet ) {
			$customized_value = $this->post_value( null );
			if ( ! is_null( $customized_value ) ) {
				$css = $customized_value;
			}
		}
		return $css;
	}

Top ↑

Changelog

Changelog
VersionDescription
4.7.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.