admin管理员组文章数量:1417554
there are 2 things I'd like to do: 1. set a post's visibility to private by default.
I've been looking around the web for a code or even a plugin that lets me do this. The problem I've run into is that the codes no longer work.
- set the pending review checkbox to true as well?
If someone can point me in the right direction, Id appreciate it.
Thank you
there are 2 things I'd like to do: 1. set a post's visibility to private by default.
I've been looking around the web for a code or even a plugin that lets me do this. The problem I've run into is that the codes no longer work.
- set the pending review checkbox to true as well?
If someone can point me in the right direction, Id appreciate it.
Thank you
Share Improve this question asked Aug 4, 2019 at 15:03 junjijunji 213 bronze badges1 Answer
Reset to default 1Found this snippet after more searching:
//Force posts of custom type to be private
//…but first make sure they are not 'trash' otherwise it is impossible to trash a post
function force_type_private($post)
{
if (($post['post_type'] == 'post')
{
if ($post['post_status'] != 'trash') $post['post_status'] = 'private';
}
return $post;
}
add_filter('wp_insert_post_data', 'force_type_private');
Changed the boolean to:
if (($post['post_type'] == 'post')&&(!current_user_can('administrator')))
This makes sure only admin can publish.
本文标签: How can I set a Post39s default visibility to private and pending review checked
版权声明:本文标题:How can I set a Post's default visibility to private and pending review checked 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745270044a2650833.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论