admin管理员组文章数量:1122832
How to remove View post
from this message ?
My code is like below.
public function game_updated_messages( $messages )
{
$messages['game'] = $messages['post'];
$messages['game'][1] = 'Post updated.';
$messages['game'][6] = 'Post published.';
return $messages;
}
How to remove View post
from this message ?
My code is like below.
public function game_updated_messages( $messages )
{
$messages['game'] = $messages['post'];
$messages['game'][1] = 'Post updated.';
$messages['game'][6] = 'Post published.';
return $messages;
}
Share
Improve this question
asked Jul 16, 2024 at 14:44
FoysalFoysal
4451 gold badge5 silver badges15 bronze badges
3
|
1 Answer
Reset to default 3I think the issue is this piece of code $messages['game'] = $messages['post'];
. $messages
will contains all the updated messages for all custom post type. In this case, your CPT is game
, so you should change the array item of game
only.
The correct code should be
public function game_updated_messages( $messages )
{
$messages['game'][1] = 'Post updated.';
$messages['game'][6] = 'Post published.';
return $messages;
}
You can try to dump the variable $messages
and see all the result it returns.
本文标签: plugin developmentRemove View post Text
版权声明:本文标题:plugin development - Remove `View post` Text 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736300660a1930895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
game_updated_messages
called? Is it on a filter if so which ones? I'm assuming this is in the classic editor? It's difficult to tell from the screenshot if it's the classic editor, a quick edit action, or something else. Is game a CPT? If so what are the labels in its registration? – Tom J Nowell ♦ Commented Jul 16, 2024 at 15:06add_filter( 'post_updated_messages', [ $this, 'game_updated_messages' ] );
. Yes, game is a CPT. How to find the labels in its registration ? Thanks. – Foysal Commented Jul 17, 2024 at 4:34