Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming "Post" to Something Else

Tags:

wordpress

wpmu

Thanks for your time.

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

The hardest location to change has been at "view all posts" where the word stubbornly refuses to change from "Posts" at the title even with site-wide text replacement via plugin.

What is the correct way to inform WordPress that I want to call Posts by a different name?

like image 645
Puck Avatar asked Oct 01 '14 16:10

Puck


People also ask

How do I rename a custom post type?

To change the name of a custom post type, simply replace all instances of the custom post type name with the new name you want to use for your CPT. Code for creating a custom post type generally includes both a singular and plural name. In this example, the names which need replacing are member and members.

How do I change the default post name in WordPress?

Hi @preez to change the single post title, on the dashboard please go to Appearance>Customize>Blog>Single Post. There you will find the “Page Header Title” option. By default, it is set to “Blog”. You can change it to “Post Title”.

Can you rename categories in WordPress?

To do this, you will need to click the 'Edit' link under the category you wish to rename. This will take you to the category edit page. Here you can change the category name, slug and description. The category edit page also lets you choose a parent category.

How to edit custom post type in WordPress?

Go to Posts and open any piece of content, or add a new one. The post type converter is located on the right side of the WordPress editor under the “Publish” section. Click the “Edit” link next to Post Type. Use the drop down box to change the post type.


1 Answers

Put this in your functions.php file (obviously change "News Articles" to whatever you want the post name 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 are worried about translation (based on the comments to your question), just add the appropriate __( 'News Articles', 'my-text-domain' ); function for each item...

like image 143
Daniel C Avatar answered Nov 15 '22 22:11

Daniel C