Software Developer

Change Posts Menu Label To a Custom Label

In the rare instance that you may want to change the label of “Posts” in the WordPress admin dashboard to a custom label, here is how to do that. For example, you may have set up a custom site for in which you need a custom post type called ‘Memories’, or ‘Announcements’, or whatever. But you don’t want to set up a custom post type because you simply want to rename the default ‘Posts’ into your custom label. So drop the following into functions.php. In this example, ‘Scrapbook’ will replace the top level menu item ‘Posts’. ‘All Memories’, View Memories’, ‘Add Memory’, and ‘Edit Memory’ will replace ‘All Posts’, ‘View Posts’, Add Post’, and ‘Edit Post’.

//change posts menu label to scrapbook
function isa_change_post_menu_label() {
	global $menu;
	global $submenu;
	$menu[5][0] = 'Scrapbook';
	$submenu['edit.php'][5][0] = 'Memories';
	$submenu['edit.php'][10][0] = 'Add Memory';

	echo '';
}
function isa_change_post_object_label() {
	global $wp_post_types;
	$labels = &$wp_post_types['post']->labels;
	$labels->name = 'Scrapbook';
	$labels->singular_name = 'Scrapbook';
	$labels->add_new = 'Add Memory';
	$labels->add_new_item = 'Add Memory';
	$labels->edit_item = 'Edit Memory';
	$labels->new_item = 'Memory';
	$labels->view_item = 'View Memories';
	$labels->search_items = 'Search Memories';
	$labels->not_found = 'No Memories found';
	$labels->not_found_in_trash = 'No Memories found in Trash';
}
add_action( 'init', 'isa_change_post_object_label' );
add_action( 'admin_menu', 'isa_change_post_menu_label' );

By

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]