简体   繁体   中英

Add custom admin menu to woocommerce

Is it possible to add a new admin menu to the woocommerce admin section in Wordpress? I've done this with WP E-commerce with my custom plugin so am wandering if the same is true for Woo commerce.

Thanks

Well, if you use something like this:

add_action('admin_menu', 'register_my_custom_submenu_page');

function register_my_custom_submenu_page() {
    add_submenu_page( 'woocommerce', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' ); 
}

function my_custom_submenu_page_callback() {
    echo '<h3>My Custom Submenu Page</h3>';

}

Then you will see a submenu under "Woocommerce" admin menu. For some reason you can´t do same using post_type=shop_order.

\n

"shop_order" is the one you should use to put a submenu under "Woocommerce" one.. but, as i said, don´t know why didn´t work with that particual post_type.

http://codex.wordpress.org/Function_Reference/add_submenu_page

For me the following worked:

add_submenu_page(
    'edit.php?post_type=product',
    PAGE_TITLE,
    MENU_TITLE,
    'manage_woocommerce',
    'custom_wc_menu'
);

Setting the $parent_slug to edit.php?post_type=product

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM