1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【WordPress】管理画面のラベルを変更

Posted at

#【WordPress】管理画面のラベルを変更

投稿メニューの新規追加画面のタイトルのラベル(デフォルトは新規投稿を追加)を変更してみる。

・initのフックに引っ掛けて、ラベル変更のロジックを入れる。
ラベルのオブジェクトを取得して、変更したい文字列を代入します。
管理画面のラベルに関してはこちら

function.php
<?php

〜〜省略〜〜

//======================================================================
// 管理メニューのラベルを変更
//======================================================================
function change_post_title_label() {
	global $wp_post_types;
	$labels = &$wp_post_types['post']->labels;
	$labels->add_new_item = 'new post!';
}
add_action( 'init', 'change_post_title_label' );

・変更前
before0621.png

・変更後
after0621.png
新規投稿を追加 → new post!に変わりました。

1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?