This is a function that will create a new admin page near "Setting/Plugins/Users" in your WordPress dashboard.
Paste the code below in your functions.php file.
define ('TWEAK_MENU_BEGIN', 25);
define ('TWEAK_MENU_END', 40);
function add_tweak_menu_page($name, $capability, $link, $title) {
global $menu;
$i = TWEAK_MENU_END;
do {
$i--;
if ( empty($menu[$i]) ) {
while ( $i < TWEAK_MENU_END ) {
$menu[$i] = $menu[$i+1];
$i++;
}
$menu[TWEAK_MENU_END] = array ( 0 => $name, $capability, $link, $title);
return true;
}
} while ( $i > TWEAK_MENU_BEGIN );
add_menu_page($name, $capability, $link, $title);
return false;
}
To call the function and add a new admin page, do the following:
add_tweak_menu_page($name, $capability, $link, $title);
Thnaks to Calak for this awesome code!
Leave a Comment