WP_Customize_Nav_Menus::customize_dynamic_partial_args() WordPress Method

The WP_Customize_Nav_Menus::customize_dynamic_partial_args() method is used to customize the arguments passed to the WP_Customize_Manager::register_dynamic_partial() method when registering a new menu partial.

WP_Customize_Nav_Menus::customize_dynamic_partial_args( array|false $partial_args, string $partial_id ) #

Filters arguments for dynamic nav_menu selective refresh partials.


Parameters

$partial_args

(array|false)(Required)Partial args.

$partial_id

(string)(Required)Partial ID.


Top ↑

Return

(array) Partial args.


Top ↑

Source

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

	public function customize_dynamic_partial_args( $partial_args, $partial_id ) {

		if ( preg_match( '/^nav_menu_instance\[[0-9a-f]{32}\]$/', $partial_id ) ) {
			if ( false === $partial_args ) {
				$partial_args = array();
			}
			$partial_args = array_merge(
				$partial_args,
				array(
					'type'                => 'nav_menu_instance',
					'render_callback'     => array( $this, 'render_nav_menu_partial' ),
					'container_inclusive' => true,
					'settings'            => array(), // Empty because the nav menu instance may relate to a menu or a location.
					'capability'          => 'edit_theme_options',
				)
			);
		}

		return $partial_args;
	}

Top ↑

Changelog

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