WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Admin\Features\Navigation

Menu::add_item() private WC 1.0

Adds a child menu item to the navigation.

{} Это метод класса: Menu{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = Menu::add_item( $args );
$args(массив) (обязательный)
Array containing the necessary arguments.
php $args = array( 'id' => (string) The unique ID of the menu item. Required. 'title' => (string) Title of the menu item. Required. 'parent' => (string) Parent menu item ID. 'capability' => (string) Capability to view this menu item. 'url' => (string) URL or callback to be used. Required. 'order' => (int) Menu item order. 'migrate' => (bool) Whether or not to hide the item in the wp admin menu. 'menuId' => (string) The ID of the menu to add the item to. 'matchExpression' => (string) A regular expression used to identify if the menu item is active. ).

Код Menu::add_item() WC 5.4.1

<?php
private static function add_item( $args ) {
	if ( ! isset( $args['id'] ) ) {
		return;
	}

	if ( isset( self::$menu_items[ $args['id'] ] ) ) {
		error_log(  // phpcs:ignore
			sprintf(
				/* translators: 1: Duplicate menu item path. */
				esc_html__( 'You have attempted to register a duplicate item with WooCommerce Navigation: %1$s', 'woocommerce' ),
				'`' . $args['id'] . '`'
			)
		);
		return;
	}

	$defaults           = array(
		'id'         => '',
		'title'      => '',
		'capability' => 'manage_woocommerce',
		'url'        => '',
		'order'      => 100,
		'migrate'    => true,
		'menuId'     => 'primary',
	);
	$menu_item          = wp_parse_args( $args, $defaults );
	$menu_item['title'] = wp_strip_all_tags( wp_specialchars_decode( $menu_item['title'] ) );
	$menu_item['url']   = self::get_callback_url( $menu_item['url'] );

	if ( ! isset( $menu_item['parent'] ) ) {
		$menu_item['parent'] = 'woocommerce';
	}

	$menu_item['menuId'] = self::get_item_menu_id( $menu_item );

	self::$menu_items[ $menu_item['id'] ]       = $menu_item;
	self::$categories[ $menu_item['parent'] ][] = $menu_item['id'];

	if ( isset( $args['url'] ) ) {
		self::$callbacks[ $args['url'] ] = $menu_item['migrate'];
	}
}