WP_Customize_Manager::get_nonces() WordPress Method

The WP_Customize_Manager::get_nonces() method is used to retrieve the nonces for the current customize request. This is useful for making sure that requests to the customizer are authorized before they are processed.

WP_Customize_Manager::get_nonces() #

Gets nonces for the Customizer.


Return

(array) Nonces.


Top ↑

Source

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

	public function get_nonces() {
		$nonces = array(
			'save'                     => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
			'preview'                  => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
			'switch_themes'            => wp_create_nonce( 'switch_themes' ),
			'dismiss_autosave_or_lock' => wp_create_nonce( 'customize_dismiss_autosave_or_lock' ),
			'override_lock'            => wp_create_nonce( 'customize_override_changeset_lock' ),
			'trash'                    => wp_create_nonce( 'trash_customize_changeset' ),
		);

		/**
		 * Filters nonces for Customizer.
		 *
		 * @since 4.2.0
		 *
		 * @param string[]             $nonces  Array of refreshed nonces for save and
		 *                                      preview actions.
		 * @param WP_Customize_Manager $manager WP_Customize_Manager instance.
		 */
		$nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this );

		return $nonces;
	}


Top ↑

Changelog

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