Rename or Replace WordPress Default Post by Custom Post Type

I almost always rename the default “post” post type to article, news, portfolio something else. If you want to simply rename the appearance of posts, rather than creating a custom post type then add bellows code. If you just want to change the admin menu label from Post -> Article, then You will just need to create another custom post with the same capabilities as a regular post. You can then disable the Posts menu with Article post menu function. All you need to do is paste this into your theme’s functions.php file.

// Replace post by vector
function custom_posts_article() {
    global $menu;
    global $submenu;
    $menu[5][0] = __("Article", 'text-domain');
    $submenu['edit.php'][5][0] = __("All Article", 'text-domain');
    $submenu['edit.php'][10][0] = __("New Item", 'text-domain');
    echo '';
}

function custom_posts_article_label() {
    global $wp_post_types;
    $labels = &$wp_post_types['post']->labels;
    $labels->name = __("Article", 'text-domain');
    $labels->singular_name = __("Article", 'text-domain');
    $labels->add_new = __("New Article", 'text-domain');
    $labels->add_new_item = __("New Article", 'text-domain');
    $labels->edit_item = __("Edit Article", 'text-domain');
    $labels->new_item = __("Article", 'text-domain');
    $labels->view_item = __("View Article", 'text-domain');
    $labels->search_items = __("Search Article", 'text-domain');
    $labels->not_found = __("No Article Found", 'text-domain');
    $labels->not_found_in_trash = __("No Article found in Trash", 'text-domain');
}
add_action( 'init', 'custom_posts_article_label' );
add_action( 'admin_menu', 'custom_posts_article' );

Just replace your by your custom post information & text-domain. All content has now been added and I just wanted to see if there was a way to rename the posts to Article. Please ask any question about this post by comment.

Leave a Comment

Your email address will not be published. Required fields are marked *

3 × 2 =

New to site? Create an Account


Login

Lost Password?

Already have an account? Login


Signup