使用 functions.php 删除预览、查看按钮和指向自定义 post 管理员的永久链接
Remove the preview, view button and permalink to custom post admin using functions.php
我有一个带有自定义 post 的自定义主题。我喜欢使用 functions.php.
删除默认 post 管理员上的 preview/view 按钮和固定链接
这是我在默认自定义中的代码 post
////////////////////Change the default post to "新規求人登録"////////////////////
function Change_menulabel() {
global $menu;
global $submenu;
$name = '新規求人登録';
$menu[5][0] = $name;
$submenu['edit.php'][5][0] = $name.'';
$submenu['edit.php'][10][0] = '新しいお知らせを追加';
}
function Change_objectlabel() {
global $wp_post_types;
$name = '新規求人登録';
$labels = &$wp_post_types['post']->labels;
$labels->name = $name;
$labels->singular_name = $name;
$labels->add_new = _x('追加', $name);
$labels->add_new_item = $name.'の新規追加';
$labels->edit_item = $name.'の編集';
$labels->new_item = '新規'.$name;
$labels->view_item = $name.'を表示';
$labels->search_items = $name.'を検索';
$labels->not_found = $name.'が見つかりませんでした';
$labels->not_found_in_trash = 'ゴミ箱に'.$name.'は見つかりませんでした';
}
add_action( 'init', 'Change_objectlabel' );
add_action( 'admin_menu', 'Change_menulabel' );
你好@shouu 你可以通过这段代码隐藏预览按钮及其永久链接
function hide_publishing_actions(){
$my_post_type = 'post';
global $post;
if($post->post_type == $my_post_type){
echo '
<style type="text/css">
#edit-slug-box,
#minor-publishing-actions{
display:none;
}
</style>
';
}
}
add_action('admin_head-post.php', 'hide_publishing_actions');
add_action('admin_head-post-new.php', 'hide_publishing_actions');
我有一个带有自定义 post 的自定义主题。我喜欢使用 functions.php.
删除默认 post 管理员上的 preview/view 按钮和固定链接这是我在默认自定义中的代码 post
////////////////////Change the default post to "新規求人登録"////////////////////
function Change_menulabel() {
global $menu;
global $submenu;
$name = '新規求人登録';
$menu[5][0] = $name;
$submenu['edit.php'][5][0] = $name.'';
$submenu['edit.php'][10][0] = '新しいお知らせを追加';
}
function Change_objectlabel() {
global $wp_post_types;
$name = '新規求人登録';
$labels = &$wp_post_types['post']->labels;
$labels->name = $name;
$labels->singular_name = $name;
$labels->add_new = _x('追加', $name);
$labels->add_new_item = $name.'の新規追加';
$labels->edit_item = $name.'の編集';
$labels->new_item = '新規'.$name;
$labels->view_item = $name.'を表示';
$labels->search_items = $name.'を検索';
$labels->not_found = $name.'が見つかりませんでした';
$labels->not_found_in_trash = 'ゴミ箱に'.$name.'は見つかりませんでした';
}
add_action( 'init', 'Change_objectlabel' );
add_action( 'admin_menu', 'Change_menulabel' );
你好@shouu 你可以通过这段代码隐藏预览按钮及其永久链接
function hide_publishing_actions(){
$my_post_type = 'post';
global $post;
if($post->post_type == $my_post_type){
echo '
<style type="text/css">
#edit-slug-box,
#minor-publishing-actions{
display:none;
}
</style>
';
}
}
add_action('admin_head-post.php', 'hide_publishing_actions');
add_action('admin_head-post-new.php', 'hide_publishing_actions');