Renaming Menu Item within Admin Menu Section for a Custom Post Type?

I have a feeling this is a bug.

When you create a new custom post type it does not seem possible to modify the first submenu item text. I am referring to the link which allows you to view the post list.

For what I can tell it just seems to be duplicating the name name of the main post type menu which was created.

Does anyone know how to modify this text so that I can have the main menu element says “Articles” and the post list submenu name to say “Manage Articles”?

I was under the impression that "edit_item" would control the text to be displayed in te submenu but for some reason this is not registering.

Here is the code I am currently using:

//////////////////////////////////////////////////////////////////////////////
// CUSTOM POSTTYPE FOR -- ARTICLES  
//////////////////////////////////////////////////////////////////////////////

add_action('init', 'articles');
function articles() {
 register_post_type('articles', array(
  'labels' => array(
   'name'   => __('Articles'),
   'singular_label'  => __('Article'),
   'new_item'   => __('Add Article'),
   'add_new'   => __('Add Article'),
   'add_new_item'  => __('Add Article'),
   'edit'   => __('Edit Article'),
   'edit_item'   => __('Edit Article'),
   'view'   => __('View Article'),
   'view_item'   => __('View Article'),
   'search_items'  => __('Search Articles'),
   'not_found'   => __('No Articles Found'),
   'not_found_in_trash' => __('No Articles Found in Trash'),
   ),
  'supports' => array(
   'thumbnail',
   'title',
   'editor',
   'author',
   'revisions',
   ),
  'rewrite' => array( 
   'slug'   => 'articles', 
   'with_front'   => false,
   ),
  'rewrite'    => true,
  'can_export'    => true,
  'show_ui'    => true,
  'menu_position'   => 3,
  'public'    => true,
  'query_var'    => true,
  'publicly_queryable'  => true,
  'exclude_from_search'  => false,
  'capability_type'   => 'post',
  'hierarchical'   => false,
 ));
 }


add_filter('manage_edit-articles_columns', 'add_new_articles_columns');
function add_new_articles_columns($articles_columns) {
 $new_columns['cb']     = '<input type="checkbox" />';
 $new_columns['article_thumbnail']   = _x('Image', 'column name');
 $new_columns['title']    = _x('Article Title', 'column name');
 $new_columns['article_excerpt']   = _x('Article Excerpt', 'column name');
 $new_columns['article_source']   = _x('Article Source', 'column name');
 $new_columns['author']    = __('Created by');
 $new_columns['date']    = _x('Last Action', 'column name');
 return $new_columns;
 }
add_action('manage_posts_custom_column', 'manage_articles_columns', 10, 2);
function manage_articles_columns($column_name, $id) {
 global $wpdb;
 switch ($column_name) { 
  case 'article_thumbnail':  
   the_post_thumbnail( array(50,50) );
   break; 
  case 'article_excerpt': echo substr(get_the_excerpt(),0,500); 
   break;
  case 'article_source':
         echo get_the_term_list($post->ID, 'content_sources', '', ', ','');
   break;
  default: break;
  }
 }

2 Answers
2

Hi @NetConstructor.com:

I think you already asked about this and I gave you an answer that would address this question too:

  • Changing the Order of Admin Menu Sections?

In that answer I gave you a library you can use to make interacting with the admin menus super easy. Here’s what you’d have to do to achieve your stated goal on this question:

<?php
require_once('wp-admin-menu-classes.php');
add_action('admin_menu','my_admin_menu');
function my_admin_menu() {
  rename_admin_menu_section('Articles','Manage Articles');`  
}

P.S. BTW, I noticed there were 4 answers provided on that question which you asked almost a week ago, but you haven’t gone back an selected any of the answers as the correct answer. Since you have been here asking a lot of questions I know it’s not like you’ve not been around; please take time to select the best answer for your questions as soon as you have a viable answer otherwise people might become demotivated to keep answering. Something this consider…

Leave a Comment