New custom link

Hi all,
Looking at the custom dashboard extension and wondered if anyone has added additional items to the dashboard admin menu using the PHP section?

I.e. Adding an external link say under the Overview item.
Thanks

Hi Chris,

Here is an example snippet you can adjust to your needs:

add_filter( 'mainwp_main_menu', 'mycustom_mainwp_main_menu', 10, 1 );
function mycustom_mainwp_main_menu( $left_menu ) {
        $index = 1;
		$sub_menu_before = array_slice( $left_menu['mainwp_tab'], 0, $index );
		$sub_menu_after  = array_splice( $left_menu['mainwp_tab'], $index );
		$addition_item   = array();
		$addition_item[] = 'Addition item';
		$addition_item[] = 'addition-item';
		$addition_item[] = 'admin.php?page=addition-item';
		$left_menu['mainwp_tab'][] = $addition_item;
		$left_menu['mainwp_tab']   = array_merge( $left_menu['mainwp_tab'], $sub_menu_after );
		return $left_menu;
}

Here you can find the hook reference:

Let me know how it goes.

1 Like

Perfect thank you @bogdan for this.

You are very welcome.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.