dam*_*001 4 php wordpress wordpress-theming
有谁知道如何在管理员的 WordPress 网站上发布帖子后隐藏出现的帖子发布消息。
我已经看到这个例子向除管理员之外的所有人隐藏更新可用消息,但我不确定需要添加什么来删除保存消息:
function hide_update_notice_to_all_but_admin_users()
{
if (!current_user_can('update_core')) {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 );
Run Code Online (Sandbox Code Playgroud)
我需要删除常规帖子和自定义帖子类型上的消息。据我所知,这应该只是替换的情况,'update_nag'但我不确定用什么替换它。
谢谢
这应该删除“发布发布”消息。
add_filter( 'post_updated_messages', 'post_published' );
function post_published( $messages )
{
unset($messages[post][6]);
return $messages;
}
Run Code Online (Sandbox Code Playgroud)
以上基于此答案,修改为仅删除“发布后”消息。