leadbellydesign
1/5/2016 - 4:20 PM

WordPress: Custom label text for custom post type labels #snippet #WordPress

WordPress: Custom label text for custom post type labels #snippet #WordPress

/**
 * Change the post type labels
 * http://www.paulund.co.uk/change-posts-text-in-admin-menu
 */
function change_post_type_labels() {
  global $wp_post_types;

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