Change Posts Text In Admin Menu

Updated: in Wordpress

Now that WordPress has all the capabilities you need from a CMS, many people say that they want WordPress to stop acting like a blog platform and more like a CMS.

There are lots of ways they can do this one is by making it easy in the admin screen to create custom post types, to easily be able to customise the data.

Another way is to to remove the word posts from the admin screen and replace this with the word article, in this tutorial you will learn how to do exactly that.

posts_to_articles

Change Posts Menu To Article

This snippet will change the post in the menu to the Articles it will also get the sub-menus and change the labels to go from posts to articles.

/**
 * Change the post menu to article
 */
function change_post_menu_text() {
  global $menu;
  global $submenu;
  // Change menu item
  $menu[5][0] = 'Articles';
  // Change post submenu
  $submenu['edit.php'][5][0] = 'Articles';
  $submenu['edit.php'][10][0] = 'Add Articles';
  $submenu['edit.php'][16][0] = 'Articles Tags';
}
add_action( 'admin_menu', 'change_post_menu_text' );

Change Post Labels To Article

When you add a new post there is a header saying add post this snippet will change it to new Article. This will also change all the places post comes up and change it to article.

/**
 * Change the post type labels
 */
function change_post_type_labels() {
  global $wp_post_types;
  // Get the post labels
  $labels = &$wp_post_types['post']->labels;
  $labels->name = 'Articles';
  $labels->singular_name = 'Articles';
  $labels->add_new = 'Add Articles';
  $labels->add_new_item = 'Add Articles';
  $labels->edit_item = 'Edit Articles';
  $labels->new_item = 'Articles';
  $labels->view_item = 'View Articles';
  $labels->search_items = 'Search Articles';
  $labels->not_found = 'No Articles found';
  $labels->not_found_in_trash = 'No Articles found in Trash';
}
add_action( 'init', 'change_post_type_labels' );

Keep updated with the latest tutorials and snippets.

Join me on Twitter | G+ | Facebook

Learn Web Design, Coding & More. No Risk. No Contracts. Learn More
Comment