Posts to be Private by default
-
Hi guys,
I am developing a members only site in which almost all posts need to have visibility = Private. Since WP makes them public by default, I looked for plugins but could only find 2 older plugins both of which I tried without luck.
I then googled for a hack and found this thread which provided the below code (thanks Steve). It does almost exactly what is needed, i.e. posts are created as Private by default, however there is one problem: on the rare occasion I need a Public post, when I save the new post it forces it to be Private even though I set it to Public (so I guess it works too good :-).
Would anyone have a tweak which could help fix this issue? The code I am using is:
//Force posts of custom type 'internt-arkiv' 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');
Thanks in advance,
Dennis
The page I need help with: [log in to see the link]
- The topic ‘Posts to be Private by default’ is closed to new replies.