widget_nav_menu_args WordPress Filter Hook

The widget_nav_menu_args hook allows you to modify the arguments used when registering a new navigation menu widget. This can be useful if you need to change the way the menu is displayed, or if you want to add custom arguments to the widget.

apply_filters( 'widget_nav_menu_args', array $nav_menu_args, WP_Term $nav_menu, array $args, array $instance ) #

Filters the arguments for the Navigation Menu widget.


Parameters

$nav_menu_args

(array)An array of arguments passed to wp_nav_menu() to retrieve a navigation menu.

  • 'fallback_cb'
    (callable|bool) Callback to fire if the menu doesn't exist. Default empty.
  • 'menu'
    (mixed) Menu ID, slug, or name.

$nav_menu

(WP_Term)Nav menu object for the current menu.

$args

(array)Display arguments for the current widget.

$instance

(array)Array of settings for the current widget.


Top ↑

Source

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

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.4.0Added the $instance parameter.
4.2.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.