Automattic\WooCommerce\Admin\Features\Navigation
Menu::get_parent_key()
Get the parent key if one exists.
Method of the class: Menu{}
No Hooks.
Return
String|null
.
Usage
$result = Menu::get_parent_key( $callback );
- $callback(string) (required)
- Callback or URL.
Menu::get_parent_key() Menu::get parent key code WC 8.7.0
public static function get_parent_key( $callback ) { global $submenu; if ( ! $submenu ) { return null; } // This is already a parent item. if ( isset( $submenu[ $callback ] ) ) { return null; } foreach ( $submenu as $key => $menu ) { foreach ( $menu as $item ) { if ( $item[ self::CALLBACK ] === $callback ) { return $key; } } } return null; }