Skip to content

Instantly share code, notes, and snippets.

@ashokdhaduk
Forked from tanmay27vats/function.php
Created May 28, 2018 04:44
Show Gist options
  • Save ashokdhaduk/47b5eb8cddcf866440198a23edc06256 to your computer and use it in GitHub Desktop.
Save ashokdhaduk/47b5eb8cddcf866440198a23edc06256 to your computer and use it in GitHub Desktop.
WordPress: Rename the default label “Posts” to “News” OR something else...
function tv_change_post_label()
{
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
}
function tv_change_post_object()
{
global $wp_post_types;
$labels = &$wp_post_types['post']->labels;
$labels->name = 'News';
$labels->singular_name = 'News';
$labels->add_new = 'Add News';
$labels->add_new_item = 'Add News';
$labels->edit_item = 'Edit News';
$labels->new_item = 'News';
$labels->view_item = 'View News';
$labels->search_items = 'Search News';
$labels->not_found = 'No News found';
$labels->not_found_in_trash = 'No News found in Trash';
$labels->all_items = 'All News';
$labels->menu_name = 'News';
$labels->name_admin_bar = 'News';
}
add_action( 'admin_menu', 'tv_change_post_label' );
add_action( 'init', 'tv_change_post_object' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment