Summery Summery

Prepares wp_nav_menu() calls for partial refresh.

Syntax Syntax

WP_Customize_Nav_Menus::filter_wp_nav_menu( string $nav_menu_content, object $args )

Description Description

Injects attributes into container element.

Parameters Parameters


(Required) The HTML content for the navigation menu.


(Required) An object containing wp_nav_menu() arguments.

Return Return

(string) Nav menu HTML with selective refresh attributes added if partial can be refreshed.

Source Source

File: wp-includes/class-wp-customize-nav-menus.php

		 * selective refreshed if...
		$can_partial_refresh = (
			// ...if wp_nav_menu() is directly echoing out the menu (and thus isn't manipulating the string after generated),
			! empty( $args['echo'] )
			// ...and if the fallback_cb can be serialized to JSON, since it will be included in the placement context data,
			( empty( $args['fallback_cb'] ) || is_string( $args['fallback_cb'] ) )


Changelog Changelog

Version Description
4.3.0 Introduced.

See also See also


Leave a Reply