1. 主页
  2. WordPress高阶
  3. 将post改为products

将post改为products

在functions.php 中添加

// 更改post为producte
function change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = ‘Products’;
$submenu[‘edit.php’][5][0] = ‘Products’;
$submenu[‘edit.php’][10][0] = ‘Add Products’;
$submenu[‘edit.php’][15][0] = ‘Product Category’; // Change name for categories
$submenu[‘edit.php’][16][0] = ‘Products Labels’; // Change name for tags
echo ”;
}

function change_post_object_label() {
global $wp_post_types;
$labels = &$wp_post_types[‘post’]->labels;
$labels->name = ‘Porducts’;
$labels->singular_name = ‘Porduct’;
$labels->add_new = ‘Add Porduct’;
$labels->add_new_item = ‘Add Porduct’;
$labels->edit_item = ‘Edit Porducts’;
$labels->new_item = ‘Porduct’;
$labels->view_item = ‘View Porduct’;
$labels->search_items = ‘Search Porducts’;
$labels->not_found = ‘No Porducts found’;
$labels->not_found_in_trash = ‘No Porducts found in Trash’;
}
add_action( ‘init’, ‘change_post_object_label’ );
add_action( ‘admin_menu’, ‘change_post_menu_label’ );

更新于 2018年12月4日

帮到你了吗?

相关文章