accepts are the same as @see add_submenu_page. This class will * aggreagate all menu items registered by stand-alone plugins and make sure they all go under the same * Jetpack top level menu. It will also handle the top level menu registration in case the Jetpack plugin is not present. * * @param string $page_title The text to be displayed in the title tags of the page when the menu * is selected. * @param string $menu_title The text to be used for the menu. * @param string $capability The capability required for this menu to be displayed to the user. * @param string $menu_slug The slug name to refer to this menu by. Should be unique for this menu * and only include lowercase alphanumeric, dashes, and underscores characters * to be compatible with sanitize_key(). * @param callable $function The function to be called to output the content for this page. * @param int $position The position in the menu order this item should appear. Leave empty typically. * * @return string The resulting page's hook_suffix */ public static function add_menu( $page_title, $menu_title, $capability, $menu_slug, $function, $position = null ) { self::init(); self::$menu_items[] = compact( 'page_title', 'menu_title', 'capability', 'menu_slug', 'function', 'position' ); /** * Let's return the page hook so consumers can use. * We know all pages will be under Jetpack top level menu page, so we can hardcode the first part of the string. * Using get_plugin_page_hookname here won't work because the top level page is not registered yet. */ return 'jetpack_page_' . $menu_slug; } /** * Gets the slug for the first item under the Jetpack top level menu * * @return string|null */ public static function get_top_level_menu_item_slug() { global $submenu; if ( ! empty( $submenu['jetpack'] ) ) { $item = reset( $submenu['jetpack'] ); if ( isset( $item[2] ) ) { return $item[2]; } } } /** * Gets the URL for the first item under the Jetpack top level menu * * @param string $fallback If Jetpack menu is not there or no children is found, return this fallback instead. Default to admin_url(). * @return string */ public static function get_top_level_menu_item_url( $fallback = false ) { $slug = self::get_top_level_menu_item_slug(); if ( $slug ) { $url = menu_page_url( $slug, false ); return $url; } $url = $fallback ? $fallback : admin_url(); return $url; } }
Fatal error: Uncaught Error: Class "Automattic\Jetpack\Admin_UI\Admin_Menu" not found in /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-my-jetpack/src/class-initializer.php:78 Stack trace: #0 /htdocs/wp-content/plugins/jetpack/class.jetpack.php(985): Automattic\Jetpack\My_Jetpack\Initializer::init() #1 /htdocs/wp-includes/class-wp-hook.php(324): Jetpack->late_initialization('') #2 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #3 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /htdocs/wp-settings.php(506): do_action('plugins_loaded') #5 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #8 /htdocs/index.php(17): require('/htdocs/wp-blog...') #9 {main} thrown in /htdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-my-jetpack/src/class-initializer.php on line 78