WP_Nav_Menu_Widget::__construct() WordPress Method

The WP_Nav_Menu_Widget::__construct() method is used to initialize the widget class. It takes two arguments: an id and a name. The id is used to uniquely identify the widget, while the name is used to display the widget name in the admin interface.

WP_Nav_Menu_Widget::__construct() #

Sets up a new Navigation Menu widget instance.


Source

File: wp-includes/widgets/class-wp-nav-menu-widget.php

	public function __construct() {
		$widget_ops = array(
			'description'                 => __( 'Add a navigation menu to your sidebar.' ),
			'customize_selective_refresh' => true,
			'show_instance_in_rest'       => true,
		);
		parent::__construct( 'nav_menu', __( 'Navigation Menu' ), $widget_ops );
	}


Top ↑

Changelog

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