Recent Update: Renaming Posts | WordPress.org

[ad_1]

Hi, thanks for the most recent update. However, I noticed that when renaming Posts to anything else then it only renames the menu item but everywhere else still refers to Posts and not the new name.

I normally use the following in my functions.php file to rename Posts to Articles and thought I would post it here to show the areas that I also rename to keep consistency throughout the site.

// Rename Posts to Articles
add_action( 'init', 'change_post_object_label' );
function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0]                 = 'Articles';
    $submenu['edit.php'][5][0]  = 'All Articles';
    $submenu['edit.php'][10][0] = 'Add New Article';
    $submenu['edit.php'][16][0] = 'Tags';
    echo '';
}
 
add_action( 'admin_menu', 'change_post_menu_label' );
function change_post_object_label() {
    global $wp_post_types;
    $labels                     = &$wp_post_types['post']->labels;
    $labels->name="Articles";
    $labels->singular_name="Article";
    $labels->add_new            = 'Add New Article';
    $labels->add_new_item       = 'Add New Article';
    $labels->edit_item          = 'Edit Article';
    $labels->new_item           = 'Article';
    $labels->view_item          = 'View Article';
    $labels->search_items="Search Articles";
    $labels->not_found          = 'No articles found';
    $labels->not_found_in_trash="No articles found in Trash";
}
 
add_action( 'admin_bar_menu', 'change_wp_admin_bar', 80 );
function change_wp_admin_bar( $wp_admin_bar ) {
    $new_post_node        = $wp_admin_bar->get_node( 'new-post' );
    $new_post_node->title="Article";              // Change title
    $wp_admin_bar->add_node( $new_post_node );      // Update Node
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer