Title: WP_Customize_Manager::get_nonces
Published: April 12, 2016
Last modified: February 24, 2026

---

# WP_Customize_Manager::get_nonces(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#wp--skip-link--target)

Gets nonces for the Customizer.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#return)󠁿

 array Nonces.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#source)󠁿

    ```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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-customize-manager.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-customize-manager.php#L4787)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-customize-manager.php#L4787-L4809)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#hooks)󠁿

 [apply_filters( ‘customize_refresh_nonces’, string[] $nonces, WP_Customize_Manager $manager )](https://developer.wordpress.org/reference/hooks/customize_refresh_nonces/)

Filters nonces for Customizer.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Customize_Manager::get_stylesheet()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_stylesheet/)`wp-includes/class-wp-customize-manager.php` |

Retrieves the stylesheet name of the previewed theme.

  | 
| [wp_create_nonce()](https://developer.wordpress.org/reference/functions/wp_create_nonce/)`wp-includes/pluggable.php` |

Creates a cryptographic token tied to a specific action, user, user session, and window of time.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#)

| Used by | Description | 
| [WP_Customize_Manager::customize_pane_settings()](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/)`wp-includes/class-wp-customize-manager.php` |

Prints JavaScript settings for parent window.

  | 
| [WP_Customize_Manager::refresh_nonces()](https://developer.wordpress.org/reference/classes/wp_customize_manager/refresh_nonces/)`wp-includes/class-wp-customize-manager.php` |

Refreshes nonces for the current preview.

  | 
| [WP_Customize_Manager::customize_preview_settings()](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_preview_settings/)`wp-includes/class-wp-customize-manager.php` |

Prints JavaScript settings for preview frame.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_manager%2Fget_nonces%2F)
before being able to contribute a note or feedback.