最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - How do I add a custom sub menu menu under Woo-commerce marketing?

programmeradmin1浏览0评论

I am developing a plugin and I want to add a menu under the woo-commerce marketing menu like the coupons and overview submenus. How am able to archieve that?

I did this but it didn't work.

add_submenu_page(
    'admin.php?page=wc-admin&path=/marketing',
     __( 'Sub Menu' ),
    'manage_woocommerce',
    'sub-menu-slug',
    'sub_menu_page_callback'
);

I am developing a plugin and I want to add a menu under the woo-commerce marketing menu like the coupons and overview submenus. How am able to archieve that?

I did this but it didn't work.

add_submenu_page(
    'admin.php?page=wc-admin&path=/marketing',
     __( 'Sub Menu' ),
    'manage_woocommerce',
    'sub-menu-slug',
    'sub_menu_page_callback'
);
Share Improve this question asked Mar 11, 2022 at 8:41 Isakiye AfashaIsakiye Afasha 1371 silver badge8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

If available the $GLOBALS[ 'menu' ] array holds data for each top level menu item in the dashboard, and in the sub array for the Woocommerce "Marketing" menu item, key 2 has the value you're looking for: "woocommerce-marketing".

So with that your add_submenu_page should look like the below to make your sub menu item show up under the Woocommerce Marketing menu item:

add_submenu_page(
    'woocommerce-marketing',
     __( 'Sub Menu' ),
    'manage_woocommerce',
    'sub-menu-slug',
    'sub_menu_page_callback'
);
发布评论

评论列表(0)

  1. 暂无评论