Last active
December 23, 2021 10:24
-
-
Save keithgreer/eaf0b4e48d4427bd4da9c5c90cd5398f to your computer and use it in GitHub Desktop.
WordPress: Rename "Posts" to something else in Admin - https://keithgreer.dev/rename-wordpress-posts-admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Rename posts in the admin menu | |
function update_post_label() { | |
global $menu; | |
global $submenu; | |
$submenu['edit.php'][5][0] = 'Story'; | |
$submenu['edit.php'][10][0] = 'Add Story'; | |
$submenu['edit.php'][16][0] = 'Story Tags'; | |
$menu[5][0] = 'Stories'; | |
} | |
add_action( 'admin_menu', 'update_post_label' ); | |
// Rename the buttons/labels in the Post section | |
function update_post_name() { | |
global $wp_post_types; | |
$labels = &$wp_post_types['post']->labels; | |
$labels->name = 'Stories'; | |
$labels->singular_name = 'Story'; | |
$labels->add_new = 'Add Story'; | |
$labels->add_new_item = 'Add Story'; | |
$labels->edit_item = 'Edit Story'; | |
$labels->new_item = 'Story'; | |
$labels->view_item = 'View Story'; | |
$labels->search_items = 'Search Story'; | |
$labels->not_found = 'No Stories found'; | |
$labels->not_found_in_trash = 'No Stories found in Trash'; | |
$labels->all_items = 'All Stories'; | |
$labels->menu_name = 'Stories'; | |
$labels->name_admin_bar = 'Stories'; | |
} | |
add_action( 'init', 'update_post_name' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment