有谁知道如何在管理员的 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 );
我需要删除常规帖子和自定义帖子类型上的消息。据我所知,这应该只是替换 'update_nag'
的情况,但我不确定用什么替换它。
谢谢
最佳答案
这应该会删除“已发布”消息。
add_filter( 'post_updated_messages', 'post_published' );
function post_published( $messages )
{
unset($messages[post][6]);
return $messages;
}
以上是根据this答案,修改为仅删除“发布后”消息。
关于php - 在 WordPress 中隐藏 "Post Published. View Post"管理员通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25791376/