Renaming "Mail" to something else

Thank you for your time.

I want the WordPress dashboard to treat posts (vanilla, not custom post types or whatever) exactly as usual, but to replace the word with something else. I've tried plugins that claim to do this, and they replace it in some places, but not others.

The hardest place to change is "view all posts", where the word stubbornly refuses to change "Posts" in the header even with replacing the text on the site via a plugin.

What's the correct way to tell WordPress that I want to call posts by a different name?


source to share

1 answer

Put this in your functions.php file (obviously change "News Articles" to whatever you want it to be):

// Function to change "posts" to "news" in the admin side menu
function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'News Articles';
    $submenu['edit.php'][5][0] = 'News Articles';
    $submenu['edit.php'][10][0] = 'Add News Article';
    $submenu['edit.php'][16][0] = 'Tags';
    echo '';
add_action( 'admin_menu', 'change_post_menu_label' );
// Function to change post object labels to "news"
function change_post_object_label() {
    global $wp_post_types;
    $labels = &$wp_post_types['post']->labels;
    $labels->name = 'News Articles';
    $labels->singular_name = 'News Article';
    $labels->add_new = 'Add News Article';
    $labels->add_new_item = 'Add News Article';
    $labels->edit_item = 'Edit News Article';
    $labels->new_item = 'News Article';
    $labels->view_item = 'View News Article';
    $labels->search_items = 'Search News Articles';
    $labels->not_found = 'No News Articles found';
    $labels->not_found_in_trash = 'No News Articles found in Trash';
add_action( 'init', 'change_post_object_label' );


And if you're concerned about the translation (based on the comments on your question), just add the appropriate function __( 'News Articles', 'my-text-domain' );

for each element ...



All Articles