Change Posts default Name and Icon

This is how to change the default ‘posts’ to ‘videos’ and swap out the dashicon for the video icon

<?php

//Rename “Posts” to “Videos”
add_action( ‘admin_menu’, ‘bigmoney_change_post_menu_label’ );
add_action( ‘init’, ‘bigmoney_change_post_object_label’ );
function bigmoney_change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = ‘Videos’;
$submenu[‘edit.php’][5][0] = ‘Videos’;
$submenu[‘edit.php’][10][0] = ‘Add Videos’;
$submenu[‘edit.php’][16][0] = ‘Video Tags’;
echo ”;
}
function pilau_change_post_object_label() {
global $wp_post_types;
$labels = &$wp_post_types[‘post’]->labels;
$labels->name = ‘Videos’;
$labels->singular_name = ‘Videos’;
$labels->add_new = ‘Add Videos’;
$labels->add_new_item = ‘Add Videos’;
$labels->edit_item = ‘Edit Videos’;
$labels->new_item = ‘Videos’;
$labels->view_item = ‘View Videos’;
$labels->search_items = ‘Search Videos’;
$labels->not_found = ‘No Videos found’;
$labels->not_found_in_trash = ‘No Videos found in Trash’;
}
//Change the posts icon to video icon
function replace_admin_menu_icons_css() {
?>
<style>
/* CSS code goes here */
#adminmenu #menu-posts div.wp-menu-image:before {
content: ‘\f126’!important;
}

</style>
<?php
}

add_action( ‘admin_head’, ‘replace_admin_menu_icons_css’ );

?>

Leave a Reply