WP_Customize_Nav_Menus::render_nav_menu_partial() WordPress Method

The WP_Customize_Nav_Menus::render_nav_menu_partial() method is used to render a partial for a given nav menu.

WP_Customize_Nav_Menus::render_nav_menu_partial( WP_Customize_Partial $partial, array $nav_menu_args ) #

Renders a specific menu via wp_nav_menu() using the supplied arguments.


Description

Top ↑

See also


Top ↑

Parameters

$partial

(WP_Customize_Partial)(Required)Partial.

$nav_menu_args

(array)(Required)Nav menu args supplied as container context.


Top ↑

Return

(string|false)


Top ↑

Source

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

	public function render_nav_menu_partial( $partial, $nav_menu_args ) {
		unset( $partial );

		if ( ! isset( $nav_menu_args['args_hmac'] ) ) {
			// Error: missing_args_hmac.
			return false;
		}

		$nav_menu_args_hmac = $nav_menu_args['args_hmac'];
		unset( $nav_menu_args['args_hmac'] );

		ksort( $nav_menu_args );
		if ( ! hash_equals( $this->hash_nav_menu_args( $nav_menu_args ), $nav_menu_args_hmac ) ) {
			// Error: args_hmac_mismatch.
			return false;
		}

		ob_start();
		wp_nav_menu( $nav_menu_args );
		$content = ob_get_clean();

		return $content;
	}


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.