WP_Customize_Nav_Menu_Setting::__construct() WordPress Method

The WP_Customize_Nav_Menu_Setting::__construct() method is used to create a new customizer setting for a navigation menu. This setting is used to store the data for a navigation menu, including the name, slug, and description.

WP_Customize_Nav_Menu_Setting::__construct( WP_Customize_Manager $manager, string $id, array $args = array() ) #

Constructor.


Description

Any supplied $args override class property defaults.


Top ↑

Parameters

$manager

(WP_Customize_Manager)(Required)Customizer bootstrap instance.

$id

(string)(Required)A specific ID of the setting. Can be a theme mod or option name.

$args

(array)(Optional) Setting arguments.

Default value: array()


Top ↑

Source

File: wp-includes/customize/class-wp-customize-nav-menu-setting.php

	public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
		if ( empty( $manager->nav_menus ) ) {
			throw new Exception( 'Expected WP_Customize_Manager::$nav_menus to be set.' );
		}

		if ( ! preg_match( self::ID_PATTERN, $id, $matches ) ) {
			throw new Exception( "Illegal widget setting ID: $id" );
		}

		$this->term_id = (int) $matches['id'];

		parent::__construct( $manager, $id, $args );
	}


Top ↑

Changelog

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