I’m developing a plugin that I’ll install for all my clients to make WordPress slightly easier to use for them. One of the things it will change is name of the W3 Total Cache Admin menu from “Performance” to “Ytelse (avansert)”.
I know how to rename the default admin menus. The code below changes “Posts” to “Nyheter”(News in Norwegian).
function change_post_menu_label_news() {
global $menu;
$menu[5][0] = 'Nyheter';
echo '';
}
add_action( 'admin_menu', 'change_post_menu_label_news' );
I find the ID to change by temporarily using this code:
add_action('admin_init','dump_admin_menu');
function dump_admin_menu() {
if (is_admin()) {
header('Content-Type:text/plain');
var_dump($GLOBALS['menu']);
exit;
}
}
However, it’s harder to rename the Performance menu since the ID increments by one when I try to rename it!. W3 Total Cache probably thinks that the ID is taken and tries a higher one.
How can I change the name of the W3 Total Cache admin Menu while avoiding this issue and without editing anything related to the plugin?
You may be able to use the WordPress filter ‘gettext’:
http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
jQuery is your friend.
Working example: http://jsfiddle.net/c3mdigital/Lq7UX/4/
I used your code to locate W3 Total Cache in the $menu array (in my case it was 102), I then copy / pasted your code to change the label, and these were the results:
I realize I got the wrong label here, but this otherwise appears to be correct, menu works as expected.