I would like to add a submenu entry under the WooCommerce "Products" admin menu. Does anybody know what the $parent_slug for this menu is?
I can add a submenu item to the "WooCommerce" menu using add_submenu_page
and 'woocommerce' for $parent_slug
(via the admin_menu
hook), but can't seem to figure out what the $parent_slug
for the Products menu is...
if ( is_admin() ) {
add_action( 'admin_menu', 'add_products_menu_entry', 100 );
}
function add_products_menu_entry() {
add_submenu_page(
'woocommerce-product', // This is what I can't figure out
__( 'Product Grabber' ),
__( 'Grab New' ),
'manage_woocommerce', // Required user capability
'ddg-product',
'generate_grab_product_page'
);
}
function generate_grab_product_page() {
// Page generation code will go here
}
WooCommerce Products Admin Menu
Got it, it was edit.php?post_type=product
if ( is_admin() ) {
add_action( 'admin_menu', 'add_products_menu_entry', 100 );
}
function add_products_menu_entry() {
add_submenu_page(
'edit.php?post_type=product',
__( 'Product Grabber' ),
__( 'Grab New' ),
'manage_woocommerce', // Required user capability
'ddg-product',
'generate_grab_product_page'
);
}
function generate_grab_product_page() {
echo "<h2>Hello, it worked! :-)</h2>";
}
Thank-you to Derick Rethans / XDebug!
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.