69
If you’re developing custom WooCommerce documentation, reporting or functionalities for your clients, you probably also need to add a new “page” and a new “submenu link” to the WordPress Admin Dashboard.
This is a very interesting topic and in the same way you can hide elements, you can also add new ones. In my case, I had to implement a custom, admin-only form to enable product recommendations. Enjoy 🙂
PHP snippet: Add New Page and Menu Link to WordPress > Products Dashboard
/**
* @snippet New WooCommerce/Products Admin Page
* @how-to Get tutoraspire.com FREE
* @author Tutor Aspire
* @compatible WooCommerce 3.5.6
* @donate $9 https://tutoraspire.com
*/
add_action( 'admin_menu', 'tutoraspire_wp_dashboard_products_new_page', 9999 );
function tutoraspire_wp_dashboard_products_new_page() {
add_submenu_page( 'edit.php?post_type=product', 'New Page Title', 'New Page Menu Title', 'edit_products', 'new_page_slug', 'tutoraspire_wp_dashboard_products_new_page_callback', 9999 );
}
function tutoraspire_wp_dashboard_products_new_page_callback() {
echo 'New Page Title
';
// add your your HTML, PHP, CSS, jQUERY here
echo '';
}