LoginSignup
1
1

More than 5 years have passed since last update.

【WordPress・プラグインなし】管理画面にあるデフォルトの「投稿」の名前を変更する方法

Last updated at Posted at 2019-03-25

管理画面にデフォルトで設定されている「投稿」は別の名前に変更することができます。
widgets.png :arrow_right: スクリーンショット 2019-04-12 12.18.09.png

functions.phpに以下を追加します。
$nameに変更したい名前を入れてください。

functions.php
function change_post_menu_label() {
  $name = '新着情報';
  global $menu;
  global $submenu;
  $menu[5][0] = $name;
  $submenu['edit.php'][5][0] = $name.'一覧';
  $submenu['edit.php'][10][0] = '新しい'.$name;
  $submenu['edit.php'][16][0] = 'タグ';
}
add_action( 'admin_menu', 'change_post_menu_label' );
function change_post_object_label() {
  $name = '新着情報';
  global $wp_post_types;
  $labels = &$wp_post_types['post']->labels;
  $labels->name = $name;
  $labels->singular_name = $name;
  $labels->add_new = '新規追加';
  $labels->add_new_item = $name.'の新規追加';
  $labels->edit_item = $name.'の編集';
  $labels->new_item = '新規'.$name;
  $labels->view_item = $name.'を表示';
  $labels->search_items = $name.'を検索';
  $labels->not_found = '記事が見つかりませんでした';
  $labels->not_found_in_trash = 'ゴミ箱に記事は見つかりませんでした';
  $menu_icon = &$wp_post_types['post']->menu_icon;
  $menu_icon = 'dashicons-star-filled';// アイコン
}
add_action('init', 'change_post_object_label');

アイコンは他にもたくさん種類があります。
https://developer.wordpress.org/resource/dashicons/

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1