admin_menu
最后更新于:2021-11-25 19:43:02
do_action( ‘admin_menu’, string $context )
Fires before the administration menu loads in the admin.
参数
- $context
-
(string)
Empty context.
源文件
文件: gc-admin/includes/menu.php
//call the 'add_menu_page' function with 'admin_menu' action hook add_action( 'admin_menu', array( $this, 'gcdocs_add_menu_page' ), 99 ); /** * Add page to admin menu */ public function gcdocs_add_menu_page() { add_menu_page( esc_html__( 'WooCommerce B2B Sales Agents', 'woocommerce-b2b-sales-agents' ), esc_html__( 'WooCommerce B2B Sales Agents', 'woocommerce-b2b-sales-agents'), 'manage_woocommerce', 'wcb2bsa-commissions', null, 'dashicons-businessman', 55.5 ); add_submenu_page( 'wcb2bsa-commissions', esc_html__( 'Commissions', 'woocommerce-b2b-sales-agents' ), esc_html__( 'Commissions', 'woocommerce-b2b-sales-agents' ), 'manage_woocommerce', 'wcb2bsa-commissions', array( $this, 'gcdocs_add_menu_page_callback' ) ); } /** * Add page to admin menu callback */ public function gcdocs_add_menu_page_callback() { include WCB2BSA_ABSPATH . 'includes/views/html-admin--page-commissions.php'; }