apply_filters( 'wp_nav_menu_args', array $args )

Filters the arguments used to display a navigation menu.

Description Description

See also See also

Top ↑

Parameters Parameters


(array) Array of wp_nav_menu() arguments.

Top ↑

Source Source

File: wp-includes/nav-menu-template.php

View on Trac

Top ↑

Changelog Changelog

Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by megamenu

    The following code will populate the “theme_location” option if it was not specified (or was left empty) in the initial call to “wp_nav_menu”.

    function wp_nav_menu_populate_missing_theme_location( $args ) {
    	if ( ! isset( $args['theme_location'] ) || $args['theme_location'] == "" ) {
    		$args['theme_location'] = 'main_navigation';
    	return $args;
    add_filter( 'wp_nav_menu_args', 'wp_nav_menu_populate_missing_theme_location' );

You must log in before being able to contribute a note or feedback.