WordPress后台菜单重命名

WordPress 后台默认管理菜单包括 文章、多媒体、页面、评论、外观、插件、用户、设置、....等等,我们可以对他们进重命名。

后台管理菜单名称重命名的方法

主题的functions.php 文件下加入以下代码:

function change_post_menu_label() {
    global $menu;
    global $submenu;
    $menu[5][0] = 'Contacts';
    $submenu['edit.php'][5][0] = 'Contacts';
    $submenu['edit.php'][10][0] = 'Add Contacts';
    $submenu['edit.php'][15][0] = 'Status'; // Change name for categories
    $submenu['edit.php'][16][0] = 'Labels'; // Change name for tags
    echo '';
}
 function change_post_object_label() {
        global $wp_post_types;
        $labels = &$wp_post_types['post']->labels;
        $labels->name = 'Contacts';
        $labels->singular_name = 'Contact';
        $labels->add_new = 'Add Contact';
        $labels->add_new_item = 'Add Contact';
        $labels->edit_item = 'Edit Contacts';
        $labels->new_item = 'Contact';
        $labels->view_item = 'View Contact';
        $labels->search_items = 'Search Contacts';
        $labels->not_found = 'No Contacts found';
        $labels->not_found_in_trash = 'No Contacts found in Trash';
    }
    add_action( 'init', 'change_post_object_label' );
    add_action( 'admin_menu', 'change_post_menu_label' );

该代码就是把原来的文章post的菜单名“post”更改为Contact。

您可能感兴趣的文章:


▪ wordpress必须禁用REST API和移除WP-JSON链接的方法

▪ Super Static Cache高级纯静态插件Wordpress提速优化神器

▪ 拯救xmlrpc.php让WordPress瘫痪的的六种办法

▪ Wordpress使用Redis缓存加速|511遇见强烈推荐

▪ 优化缩小你的wordpress数据库手动清除Transients

▪ wordpress定时发送失败的原因及四种解决办法

▪ wordpress使用memcached缓存数据提高访问速度

▪ 改变WordPress后台管理菜单排列顺序的两种方法

▪ WordPress高亮显示当前页面所在的分类的两种方法

▪ 为什么我的wordpress首页没有关键词没有描述都是is_home()惹得

猜你喜欢

转载自blog.csdn.net/zcp528/article/details/108442916