wppaste
WordPress

WP_Customize_Nav_Menu_Setting

Since
4.3.0
Source
wp-includes/customize/class-wp-customize-nav-menu-setting.php:21
Customize Setting to represent a nav_menu.

Description

Subclass of WP_Customize_Setting to represent a nav_menu taxonomy term, and the IDs for the nav_menu_items associated with the nav menu.

Compatibility

WordPress
since 4.3.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 · 1

Every hook that fires from inside WP_Customize_Nav_Menu_Setting, in the order it appears in the class, grouped by the method that fires it.

Properties · 10

$typestringpublic
Setting type.
$defaultarraypublic
Default setting value.
$transportstringpublic
Default transport.
$term_idintpublic
The term ID represented by this setting instance.
$previous_term_idintpublic
Previous (placeholder) term ID used before creating a new menu.
$is_updatedboolprotected
Whether or not update() was called.
$update_statusstringpublic
Status for calling the update method, used in customize_save_response filter.
$update_errorWP_Errorpublic
Any error object returned by wp_update_nav_menu_object() when setting is updated.
$_current_menus_sort_orderbystringprotected
Temporary non-closure passing of orderby value to function.
$_widget_nav_menu_updatesarrayprotected
Storage for data to be sent back to client in customize_save_response filter.

Methods · 11

Source code

class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting { 	const ID_PATTERN = '/^nav_menu\[(?P<id>-?\d+)\]$/'; 	const TAXONOMY = 'nav_menu'; 	const TYPE = 'nav_menu'; 	/**	 * Setting type.	 *	 * @since 4.3.0	 * @var string	 */	public $type = self::TYPE; 	/**	 * Default setting value.	 *	 * @since 4.3.0	 * @var array	 *	 * @see wp_get_nav_menu_object()	 */	public $default = array(		'name'        => '',		'description' => '',		'parent'      => 0,		'auto_add'    => false,	); 	/**	 * Default transport.	 *	 * @since 4.3.0	 * @var string	 */	public $transport = 'postMessage'; 	/**	 * The term ID represented by this setting instance.	 *	 * A negative value represents a placeholder ID for a new menu not yet saved.	 *	 * @since 4.3.0	 * @var int	 */	public $term_id; 	/**	 * Previous (placeholder) term ID used before creating a new menu.	 *	 * This value will be exported to JS via the {@see 'customize_save_response'} filter	 * so that JavaScript can update the settings to refer to the newly-assigned	 * term ID. This value is always negative to indicate it does not refer to	 * a real term.	 *	 * @since 4.3.0	 * @var int	 *	 * @see WP_Customize_Nav_Menu_Setting::update()	 * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response()	 */	public $previous_term_id; 	/**	 * Whether or not update() was called.	 *	 * @since 4.3.0	 * @var bool	 */	protected $is_updated = false; 	/**	 * Status for calling the update method, used in customize_save_response filter.	 *	 * See {@see 'customize_save_response'}.	 *	 * When status is inserted, the placeholder term ID is stored in `$previous_term_id`.	 * When status is error, the error is stored in `$update_error`.

Changelog

Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/customize/class-wp-customize-nav-menu-setting.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.