Add a New Menu Link to Vendor Dashboard

This long snippet adds a new menu item, in this case a link to the Vendor’s regular My Account page. On my site, many of my vendors also buy from other vendors, and this helps them get to their regular orders page since they likely have bookmarked their Vendor Dashboard. Also, if you’re redirecting your vendors by default to their dashboard on login, this can be a nice touch.

You can also use this as a starting point to add more content, but that was both beyond my need and abilities :-). The WCMp knowledgebase has the starting point I used for this, and there might be some unnecessary stuff in here as a result.

As always, this is either added to your Child Theme’s functions.php file, or consider using the My Custom Functions Pro plugin to manage and organize all your snippets.

add_action('wcmp_init', 'after_wcmp_init');
function after_wcmp_init() {
	// add a setting field to wcmp endpoint settings page
	add_action('settings_vendor_general_tab_options', 'add_custom_endpoint_option');
	// save setting option for custom endpoint
	add_filter('settings_vendor_general_tab_new_input', 'save_custom_endpoint_option', 10, 2);
	// add custom endpoint
	add_filter('wcmp_endpoints_query_vars', 'add_wcmp_endpoints_query_vars');
	// add custom menu to vendor dashboard
	add_filter('wcmp_vendor_dashboard_nav', 'add_tab_to_vendor_dashboard');
	// display content of custom endpoint
	add_action('wcmp_vendor_dashboard_custom-wcmp-nenu_endpoint', 'custom_menu_endpoint_content');

function add_custom_endpoint_option($settings_tab_options) {
	$settings_tab_options['sections']['wcmp_vendor_general_settings_endpoint_ssection']['fields']['wcmp_custom_vendor_endpoint'] = array('title' => __('Custom Menu', 'dc-woocommerce-multi-vendor'), 'type' => 'text', 'id' => 'wcmp_custom_vendor_endpoint', 'label_for' => 'wcmp_custom_vendor_endpoint', 'name' => 'wcmp_custom_vendor_endpoint', 'hints' => __('Set endpoint for custom menu page', 'dc-woocommerce-multi-vendor'), 'placeholder' => 'custom-wcmp-nenu');
	return $settings_tab_options;

function save_custom_endpoint_option($new_input, $input) {
	if (isset($input['wcmp_custom_vendor_endpoint']) && !empty($input['wcmp_custom_vendor_endpoint'])) {
		$new_input['wcmp_custom_vendor_endpoint'] = sanitize_text_field($input['wcmp_custom_vendor_endpoint']);
	return $new_input;
function add_wcmp_endpoints_query_vars($endpoints) {
	$endpoints['custom-wcmp-nenu'] = array(
		'label' => __('Custom Menu', 'dc-woocommerce-multi-vendor'),
		'endpoint' => get_wcmp_vendor_settings('wcmp_custom_vendor_endpoint', 'vendor', 'general', 'custom-wcmp-nenu')
	return $endpoints;
function add_tab_to_vendor_dashboard($nav) {
	$nav['custom_wcmp_nenu'] = array(
		'label' => __('Customer Account', 'dc-woocommerce-multi-vendor'), // menu label
		'url' => '', // Your url
		'capability' => true, // capability if any
		'position' => 75, // position of the menu
		'link_target' => '',
		'nav_icon' => 'dashicons dashicons-update', // choose your menu icon
		'submenu'     => array()
	return $nav; 	

Tested and working on Woocommerce 4.6.1, WCMp 3.5.10

Is this no longer relevant or not working? Please let us know in the comments!

One thought on “Add a New Menu Link to Vendor Dashboard

Comments on this post

Your email address will not be published. Required fields are marked *