W3cubDocs

/WordPress

WP_Customize_Widgets::get_selective_refreshable_widgets()

List whether each registered widget can be use selective refresh.

Description

If the theme does not support the customize-selective-refresh-widgets feature, then this will always return an empty array.

Return

(array) Mapping of id_base to support. If theme doesn't support selective refresh, an empty array is returned.

Source

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

public function get_selective_refreshable_widgets() {
		global $wp_widget_factory;
		if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) {
			return array();
		}
		if ( ! isset( $this->selective_refreshable_widgets ) ) {
			$this->selective_refreshable_widgets = array();
			foreach ( $wp_widget_factory->widgets as $wp_widget ) {
				$this->selective_refreshable_widgets[ $wp_widget->id_base ] = ! empty( $wp_widget->widget_options['customize_selective_refresh'] );
			}
		}
		return $this->selective_refreshable_widgets;
	}

Changelog

Version Description
4.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_widgets/get_selective_refreshable_widgets