WP_Customize_Selective_Refresh
- Since
- 4.5.0
- Source
wp-includes/customize/class-wp-customize-selective-refresh.php:15
Core Customizer class for implementing selective refresh.
Compatibility
- WordPress
- since 4.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 7
Every hook that fires from inside WP_Customize_Selective_Refresh, in the order it appears in the class, grouped by the method that fires it.
WP_Customize_Selective_Refresh::add_partial()
- apply_filters( customize_dynamic_partial_args )filter line 102
- apply_filters( customize_dynamic_partial_class )filter line 105
Properties · 4
$managerWP_Customize_Managerpublic- Customize manager.
$partialsWP_Customize_Partial[]protected- Registered instances of WP_Customize_Partial.
$triggered_errorsarrayprotected- Log of errors triggered when partials are rendered.
$current_partial_idstring|nullprotected- Keep track of the current partial being rendered.
Methods · 12
- __construct()Plugin bootstrap for Partial Refresh functionality.
- partials()Retrieves the registered partials.
- add_partial()Adds a partial.
- get_partial()Retrieves a partial.
- remove_partial()Removes a partial.
- init_preview()Initializes the Customizer preview.
- enqueue_preview_scripts()Enqueues preview scripts.
- export_preview_data()Exports data in preview after it has finished rendering so that partials can be added at runtime.
- add_dynamic_partials()Registers dynamically-created partials.
- is_render_partials_request()Checks whether the request is for rendering partials.
- handle_error()Handles PHP errors triggered during rendering the partials.
- handle_render_partials_request()Handles the Ajax request to return the rendered partials for the requested placements.
Source code
#[AllowDynamicProperties]final class WP_Customize_Selective_Refresh { /** * Query var used in requests to render partials. * * @since 4.5.0 */ const RENDER_QUERY_VAR = 'wp_customize_render_partials'; /** * Customize manager. * * @since 4.5.0 * @var WP_Customize_Manager */ public $manager; /** * Registered instances of WP_Customize_Partial. * * @since 4.5.0 * @var WP_Customize_Partial[] */ protected $partials = array(); /** * Log of errors triggered when partials are rendered. * * @since 4.5.0 * @var array */ protected $triggered_errors = array(); /** * Keep track of the current partial being rendered. * * @since 4.5.0 * @var string|null */ protected $current_partial_id; /** * Plugin bootstrap for Partial Refresh functionality. * * @since 4.5.0 * * @param WP_Customize_Manager $manager Customizer bootstrap instance. */ public function __construct( WP_Customize_Manager $manager ) { $this->manager = $manager; require_once ABSPATH . WPINC . '/customize/class-wp-customize-partial.php'; add_action( 'customize_preview_init', array( $this, 'init_preview' ) ); } /** * Retrieves the registered partials. * * @since 4.5.0 * * @return array Partials. */ public function partials() { return $this->partials; } /** * Adds a partial. * * @since 4.5.0 * * @see WP_Customize_Partial::__construct() * * @param WP_Customize_Partial|string $id Customize Partial object, or Partial ID. * @param array $args Optional. Array of properties for the new Partials object. * See WP_Customize_Partial::__construct() for information * on accepted arguments. Default empty array. * @return WP_Customize_Partial The instance of the partial that was added. */Changelog
Introduced in 4.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/customize/class-wp-customize-selective-refresh.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.