WP_Customize_Manager
- Since
- 3.4.0
- Source
wp-includes/class-wp-customize-manager.php:23
Customize Manager class.
Description
Bootstraps the Customize experience on the server-side.
Sets up the theme-switching process if a theme other than the active one is being previewed and customized.
Serves as a factory for Customize Controls and Settings, and instantiates default Customize Controls and Settings.
Compatibility
- WordPress
- since 3.4.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 · 30
Every hook that fires from inside WP_Customize_Manager, in the order it appears in the class, grouped by the method that fires it.
WP_Customize_Manager::set_post_value()
- do_action( customize_post_value_set_{$setting_id} )action line 1882
- do_action( customize_post_value_set )action line 1898
WP_Customize_Manager::validate_setting_values()
- apply_filters( customize_validate_{$setting->id} )filter line 2375
WP_Customize_Manager::save_changeset_post()
- do_action( customize_save_validation_before )action line 2779
- apply_filters( customize_changeset_save_data )filter line 2904
WP_Customize_Manager::trash_changeset_post()
- apply_filters( pre_trash_post )filter line 3090
- do_action( wp_trash_post )action line 3096
- do_action( edit_post_{$post->post_type} )action line 3109
- do_action( edit_post )action line 3112
- do_action( save_post_{$post->post_type} )action line 3115
- do_action( save_post )action line 3118
- do_action( wp_insert_post )action line 3121
- do_action( trashed_post )action line 3128
WP_Customize_Manager::_publish_changeset_values()
- do_action( customize_save )action line 3553
- do_action( customize_save_after )action line 3606
WP_Customize_Manager::add_setting()
- apply_filters( customize_dynamic_setting_args )filter line 3788
- apply_filters( customize_dynamic_setting_class )filter line 3791
WP_Customize_Manager::add_dynamic_settings()
- apply_filters( customize_dynamic_setting_args )filter line 3837
- apply_filters( customize_dynamic_setting_class )filter line 3851
Properties · 29
$themeWP_Themeprotected- An instance of the theme being previewed.
$original_stylesheetstringprotected- The directory name of the previously active theme (within the theme_root).
$previewingboolprotected- Whether this is a Customizer pageload.
$widgetsWP_Customize_Widgetspublic- Methods and properties dealing with managing widgets in the Customizer.
$selective_refreshWP_Customize_Selective_Refreshpublic- Methods and properties dealing with selective refresh in the Customizer preview.
$settingsarrayprotected- Registered instances of WP_Customize_Setting.
$containersarrayprotected- Sorted top-level instances of WP_Customize_Panel and WP_Customize_Section.
$panelsarrayprotected- Registered instances of WP_Customize_Panel.
$componentsarrayprotected- List of core components.
$sectionsarrayprotected- Registered instances of WP_Customize_Section.
$controlsarrayprotected- Registered instances of WP_Customize_Control.
$registered_panel_typesarrayprotected- Panel types that may be rendered from JS templates.
$registered_section_typesarrayprotected- Section types that may be rendered from JS templates.
$registered_control_typesarrayprotected- Control types that may be rendered from JS templates.
$preview_urlstringprotected- Initial URL being previewed.
$return_urlstringprotected- URL to link the user to when closing the Customizer.
$autofocusstring[]protected- Mapping of 'panel', 'section', 'control' to the ID which should be autofocused.
$messenger_channelstringprotected- Messenger channel.
$autosavedboolprotected- Whether the autosave revision of the changeset should be loaded.
$branchingboolprotected- Whether the changeset branching is allowed.
$settings_previewedboolprotected- Whether settings should be previewed.
$saved_starter_content_changesetboolprotected- Whether a starter content changeset was saved.
$_post_valuesarrayprivate- Unsanitized values for Customize Settings parsed from $_POST['customized'].
$_changeset_uuidstringprivate- Changeset UUID.
$_changeset_post_idint|falseprivate- Changeset post ID.
$_changeset_dataarray|nullprivate- Changeset data loaded from a customize_changeset post.
$pending_starter_content_settings_idsarrayprotected- Starter content setting IDs.
$store_changeset_revisionboolprotected- Determines whether a changeset revision should be made.
Methods · 117
- __construct()Constructor.
- doing_ajax()Returns true if it's an Ajax request.
- wp_die()Custom wp_die wrapper. Returns either the standard message for UI or the Ajax message.
- wp_die_handler()Returns the Ajax wp_die() handler if it's a customized request.
- setup_theme()Starts preview and customize theme.
- establish_loaded_changeset()Establishes the loaded changeset.
- after_setup_theme()Callback to validate a theme once it is loaded
- start_previewing_theme()If the theme to be previewed isn't the active theme, add filter callbacks to swap it out at runtime.
- stop_previewing_theme()Stops previewing the selected theme.
- settings_previewed()Gets whether settings are or will be previewed.
- autosaved()Gets whether data from a changeset's autosaved revision should be loaded if it exists.
- branching()Whether the changeset branching is allowed.
- changeset_uuid()Gets the changeset UUID.
- theme()Gets the theme being customized.
- settings()Gets the registered settings.
- controls()Gets the registered controls.
- containers()Gets the registered containers.
- sections()Gets the registered sections.
- panels()Gets the registered panels.
- is_theme_active()Checks if the current theme is active.
- wp_loaded()Registers styles/scripts and initialize the preview of each setting
- wp_redirect_status()Prevents Ajax requests from following redirects when previewing a theme by issuing a 200 response instead of a 30x.
- find_changeset_post_id()Finds the changeset post ID for a given changeset UUID.
- get_changeset_posts()Gets changeset posts.
- dismiss_user_auto_draft_changesets()Dismisses all of the current user's auto-drafts (other than the present one).
- changeset_post_id()Gets the changeset post ID for the loaded changeset.
- get_changeset_post_data()Gets the data stored in a changeset post.
- changeset_data()Gets changeset data.
- import_theme_starter_content()Imports theme starter content into the customized state.
- prepare_starter_content_attachments()Prepares starter content attachments.
- _save_starter_content_changeset()Saves starter content changeset.
- unsanitized_post_values()Gets dirty pre-sanitized setting values in the current customized state.
- post_value()Returns the sanitized value for a given setting from the current customized state.
- set_post_value()Overrides a setting's value in the current customized state.
- customize_preview_init()Prints JavaScript settings.
- filter_iframe_security_headers()Filters the X-Frame-Options and Content-Security-Policy headers to ensure frontend can load in customizer.
- add_state_query_params()Adds customize state query params to a given URL if preview is allowed.
- customize_preview_override_404_status()Prevents sending a 404 status when returning the response for the customize preview, since it causes the jQuery Ajax to fail. Send 200 instead.
- customize_preview_base()Prints base element for preview frame.
- customize_preview_html5()Prints a workaround to handle HTML5 tags in IE < 9.
- customize_preview_loading_style()Prints CSS for loading indicators for the Customizer preview.
- remove_frameless_preview_messenger_channel()Removes customize_messenger_channel query parameter from the preview window when it is not in an iframe.
- customize_preview_settings()Prints JavaScript settings for preview frame.
- customize_preview_signature()Prints a signature so we can ensure the Customizer was properly executed.
- remove_preview_signature()Removes the signature in case we experience a case where the Customizer was not properly executed.
- is_preview()Determines whether it is a theme preview or not.
- get_template()Retrieves the template name of the previewed theme.
- get_stylesheet()Retrieves the stylesheet name of the previewed theme.
- get_template_root()Retrieves the template root of the previewed theme.
- get_stylesheet_root()Retrieves the stylesheet root of the previewed theme.
- current_theme()Filters the active theme and return the name of the previewed theme.
- validate_setting_values()Validates setting values.
- prepare_setting_validity_for_js()Prepares setting validity for exporting to the client (JS).
- save()Handles customize_save WP Ajax request to save/update a changeset.
- save_changeset_post()Saves the post for the loaded changeset.
- preserve_insert_changeset_post_content()Preserves the initial JSON post_content passed to save into the post.
- trash_changeset_post()Trashes or deletes a changeset post.
- handle_changeset_trash_request()Handles request to trash a changeset.
- grant_edit_post_capability_for_changeset()Re-maps 'edit_post' meta cap for a customize_changeset post to be the same as 'customize' maps.
- set_changeset_lock()Marks the changeset post as being currently edited by the current user.
- refresh_changeset_lock()Refreshes changeset lock with the current time if current user edited the changeset before.
- add_customize_screen_to_heartbeat_settings()Filters heartbeat settings for the Customizer.
- get_lock_user_data()Gets lock user data.
- check_changeset_lock_with_heartbeat()Checks locked changeset with heartbeat API.
- handle_override_changeset_lock_request()Removes changeset lock when take over request is sent via Ajax.
- _filter_revision_post_has_changed()Filters whether a changeset has changed to create a new revision.
- _publish_changeset_values()Publishes the values of a changeset.
- update_stashed_theme_mod_settings()Updates stashed theme mod settings.
- refresh_nonces()Refreshes nonces for the current preview.
- handle_dismiss_autosave_or_lock_request()Deletes a given auto-draft changeset or the autosave revision for a given changeset or delete changeset lock.
- add_setting()Adds a customize setting.
- add_dynamic_settings()Registers any dynamically-created settings, such as those from $_POST['customized'] that have no corresponding setting created.
- get_setting()Retrieves a customize setting.
- remove_setting()Removes a customize setting.
- add_panel()Adds a customize panel.
- get_panel()Retrieves a customize panel.
- remove_panel()Removes a customize panel.
- register_panel_type()Registers a customize panel type.
- render_panel_templates()Renders JS templates for all registered panel types.
- add_section()Adds a customize section.
- get_section()Retrieves a customize section.
- remove_section()Removes a customize section.
- register_section_type()Registers a customize section type.
- render_section_templates()Renders JS templates for all registered section types.
- add_control()Adds a customize control.
- get_control()Retrieves a customize control.
- remove_control()Removes a customize control.
- register_control_type()Registers a customize control type.
- render_control_templates()Renders JS templates for all registered control types.
- _cmp_priority()Helper function to compare two objects by priority, ensuring sort stability via instance_number.
- prepare_controls()Prepares panels, sections, and controls.
- enqueue_control_scripts()Enqueues scripts for customize controls.
- is_ios()Determines whether the user agent is iOS.
- get_document_title_template()Gets the template string for the Customizer pane document title.
- set_preview_url()Sets the initial URL to be previewed.
- get_preview_url()Gets the initial URL to be previewed.
- is_cross_domain()Determines whether the admin and the frontend are on different domains.
- get_allowed_urls()Gets URLs allowed to be previewed.
- get_messenger_channel()Gets messenger channel.
- set_return_url()Sets URL to link the user to when closing the Customizer.
- get_return_url()Gets URL to link the user to when closing the Customizer.
- set_autofocus()Sets the autofocused constructs.
- get_autofocus()Gets the autofocused constructs.
- get_nonces()Gets nonces for the Customizer.
- customize_pane_settings()Prints JavaScript settings for parent window.
- get_previewable_devices()Returns a list of devices to allow previewing.
- register_controls()Registers some default controls.
- has_published_pages()Returns whether there are published pages.
- register_dynamic_settings()Adds settings from the POST data that were not added with code, e.g. dynamically-created settings for Widgets
- handle_load_themes_request()Loads themes into the theme browsing/installation UI.
- _sanitize_header_textcolor()Callback for validating the header_textcolor value.
- _sanitize_background_setting()Callback for validating a background setting value.
- export_header_video_settings()Exports header video settings to facilitate selective refresh.
- _validate_header_video()Callback for validating the header_video value.
- _validate_external_header_video()Callback for validating the external_header_video value.
- _sanitize_external_header_video()Callback for sanitizing the external_header_video value.
- _render_custom_logo_partial()Callback for rendering the custom logo, used in the custom_logo partial.
Source code
#[AllowDynamicProperties]final class WP_Customize_Manager { /** * An instance of the theme being previewed. * * @since 3.4.0 * @var WP_Theme */ protected $theme; /** * The directory name of the previously active theme (within the theme_root). * * @since 3.4.0 * @var string */ protected $original_stylesheet; /** * Whether this is a Customizer pageload. * * @since 3.4.0 * @var bool */ protected $previewing = false; /** * Methods and properties dealing with managing widgets in the Customizer. * * @since 3.9.0 * @var WP_Customize_Widgets */ public $widgets; /** * Methods and properties dealing with managing nav menus in the Customizer. * * @since 4.3.0 * @var WP_Customize_Nav_Menus */ public $nav_menus; /** * Methods and properties dealing with selective refresh in the Customizer preview. * * @since 4.5.0 * @var WP_Customize_Selective_Refresh */ public $selective_refresh; /** * Registered instances of WP_Customize_Setting. * * @since 3.4.0 * @var array */ protected $settings = array(); /** * Sorted top-level instances of WP_Customize_Panel and WP_Customize_Section. * * @since 4.0.0 * @var array */ protected $containers = array(); /** * Registered instances of WP_Customize_Panel. * * @since 4.0.0 * @var array */ protected $panels = array(); /** * List of core components. * * @since 4.5.0 * @var array */Changelog
Introduced in 3.4.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 6.8.8 tag, from
src/wp-includes/class-wp-customize-manager.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.