Add the following code snippet in your theme’s function file.
/**
* Set Post Status to Private
* https://wordpress.org/support/topic/post-pagination-how-to-make-two-versions-of-the-same-link/
*/
function set_post_status_private( $status, $post_id ) {
$status = 'private';
return $status;
}
add_filter( 'status_edit_pre', 'set_post_status_private', 10, 2 );
Post status will be set to ‘Private’ after publishing the post.
Thanks for this @nikhilbhansi but it doesn’t work.
Hi @nikhilbhansi,
Again thanks. Unfortunately, it’s still a no go. I tried it on the sandbox as well- the posts are visible to the public.
I’m going to try to ask the theme makers to see if they can help out (using the free version ATM)…hopefully they’ll respond
@nikhilbhansi Thanks for pointing me in the right direction.
did more searching & found the following:
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')))
So only Admin can publish. Works as intended.
It’s good that the problem is now sorted. 🙂
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
@nikhilbhansi Also do not setup temporary sites and post the user and password, I have archived that too.