Tag Info

New answers tagged


The correct way to automatically mark a post as private is to do it with the wp_insert_post_data filter. It's very straightforward: add_filter('wp_insert_post_data', 'mark_post_private'); function mark_post_private($data) { if($data['post_type'] == 'your_post_type_goes_here') { $data['post_status'] = 'private'; } return $data; }


here is a video how to set up for posts to be private by default. It is easy. Good luck ! https://www.youtube.com/watch?v=ukAlmqnTbNI


I'm using this: if ( current_user_can('read_private_pages') ) With this condition, only Administrators and Editors can view the content of the page.

Top 50 recent answers are included