How to rename default posts-type Posts

I used the following script to rename the default post type:

function change_post_menu_label() {
    global $menu, $submenu;

    $menu[5][0] = 'Portfolio';
    $submenu['edit.php'][5][0] = 'Portfolio';
    $submenu['edit.php'][10][0] = 'New Portfolio';
    $submenu['edit.php'][16][0] = 'Portfolio 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="Portfolio";
    $labels->singular_name="Portfolio";
    $labels->add_new = 'New Portfolio';
    $labels->add_new_item = 'New Portfolio';
    $labels->edit_item = 'Edit Portfolio';
    $labels->new_item = 'New Portfolio';
    $labels->view_item = 'View Portfolio';
    $labels->search_items="Search Portfolio";
    $labels->not_found = 'Not found';
    $labels->not_found_in_trash="Not found in trash";
}
add_action( 'init', 'change_post_object_label' );

Leave a Comment

tech