I have spent the last day using the functions.php file to fully customize WordPress for my client sites. I am amazed at how much I have been able to accomplish and how much easier it will make things for my clients.
I have removed certain menu items for users that are not logged in as an admin. What I am hoping (and from what I have read know it can be done) is to find a way to rename some of the menu items (left sidebar in the admin area). For instance change Posts to Articles.
If anyone can supply the code for the functions.php file or point me in the direction I would greatly appreciate it!
Here’s the process to change the labels (I changed posts to “contacts” in my example)
To change the menu order, go with this:
I’ve got code to remove items, but it’s globally and not based on user access level
To rename default post type (or any other for that matter) just use filter
post_type_labels_{$post_type}
. For defaultpost
it will bepost_type_labels_post
. In the code below is the full list of labels (WP 4.7.1
). You do not have to change everything.If you want internationalization support, just use
__( $text, $textdomain )
like:I found the filter in function:
get_post_type_labels()
from a filewp-includes/post.php
:You might want to look at this question
and the class they mention there on gist
which holds functions that you ara looking for
to rename for instance change Posts to Articles
and you can remove the appearances menu and create you new top page menu item for
I agree.. The
functions.php
file gives lots of flexibility. I’ve needed some of the same functionality that you described with a combination offunctions.php
filters and this plugin.From what I can tell..this plugin would accomplish both of your issues and it works well in Multi-Site install situations too. Hope that helps.
Norcross’s example above is right on, but I needed the possibility of internationalization. If I had the reputation, this would be a comment under Norcross’s answer, but since I don’t, i’ll just put the modified code here. ‘i18n_context’ is an arbitrary namespace for the translation context, this could be the name of your plugin or theme for example.