Rename WordPress Admin Menu Items in Custom Template or Theme
If you have purchased a theme from TemplateMonster or another WordPress theme site, it is likely that some of the custom post types used to create things like portfolio, client, or testimonial pages, as well as the URLs that those pages write to, may not be named optimally.
Most recently for us, we had a client that owned a shopping center and wanted each store to have a profile page. Well the template they chose had a “Client” custom post type that did exactly what we wanted it to, except it was labeled “Clients” in the admins and the urls it wrote to were “/clients-view/page-name“, which is less than optimal.
What we want to do is change the “Clients” label in the WordPress admin/dashboard to “Stores” so that the admin is more user friendly, then change the “clients-view” in the URL to read “store” so that the URL makes sense and it is a tad bit more SEO friendly.
The change is fairly simple, but the location of the code may very from template to template. If it is a Template Monster template, they typically use similar code structure, so you should find it in the same location.
We were looking for the below code relating to “Clients“, and we found it in the “theme-init.php” file here:
/wp-content/themes/theme####/includes/theme-init.php
/* Clients */ function my_post_type_clients() { register_post_type( 'clients', array( 'label' => __('Clients'), 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => false, 'menu_position' => 5, 'rewrite' => array( 'slug' => 'clients-view', 'with_front' => FALSE, ), 'supports' => array( 'title', 'thumbnail', 'editor', 'excerpt') ) ); } add_action('init', 'my_post_type_clients');
Now all we need to do to make the visual changes apparent is change…
'label' => __('Clients'),
to
'label' => __('Stores'),
AND
'slug' => 'clients-view',
to
'slug' => 'store',
One more thing…
Now that we’ve changed the url structure by changing the slug name, we need to reset the permalinks. This is a common issue with WordPress that most people beat themselves up over for a long time before figuring it out. Anytime you change anything having to do with URLs in WordPress and pages won’t load, etc, always go to Settings>>Permalinks>>Save Changes. Note that you shouldn’t have to actually making any changes, it just resets everything so that it should work.
That’s It!
The label in the admin now says “Stores” and the urls say “store” instead of “clients-view”.
Changing the labels of any of the WordPress default admin menu items…
To change the default menu items, you need to go to “/wp-admin/menu.php“.
Once you open menu.php, you are looking for the array value for the menu item you are trying to change. Lets say you want to change “Posts” to “Articles“. In that case, you would be looking for the following line of code:
$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
All you have to do here is change the ‘Posts’ to ‘Articles’, and you’re done.
Sub-menus can be changed similarly. Below each $menu[] item in the menu.php code, there is a $submenu[] item that can be updated in the same manner as the above change.
Hopefully this helps someone out there that is banging their head against the issue and wants to make their site or their client’s site more user friendly.
Very good.Thank you very much
Very good.Thank you very much