Automattic\WooCommerce\Admin\Features\Navigation

Menu::add_plugin_category()public staticWC 1.0

Adds a plugin category.

Method of the class: Menu{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = Menu::add_plugin_category( $args );
$args(array) (required)
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. 'url' => (string) URL or callback to be used. Required. 'migrate' => (bool) Whether or not to hide the item in the wp admin menu. 'order' => (int) Menu item order. ).

Menu::add_plugin_category() code WC 8.7.0

public static function add_plugin_category( $args ) {
	$category_args = array_merge(
		$args,
		array(
			'menuId' => 'plugins',
		)
	);

	if ( ! isset( $category_args['parent'] ) ) {
		unset( $category_args['order'] );
	}

	$menu_id = self::get_item_menu_id( $category_args );
	if ( ! in_array( $menu_id, array( 'plugins', 'favorites' ), true ) ) {
		return;
	}

	$category_args['menuId'] = $menu_id;

	self::add_category( $category_args );
}