Support » Fixing WordPress » Post private per default

  • I would also like to be able to set the default post to private, i.e. have the Keep this post private ticked by default. I use the Post Level plugin and have set the default post level but I must remember to tick the private box every time which is not good.

    If I look in wp-admin/edit-form-advanced.php I see on line 101 that the “Keep this post private” check-box is checked if the PHP function checked($post->post_status, 'private'); returns checked.

    How can I make it return checked per default? I could also just delete the function and hard-code checked but I’m not sure if that is such a good idea – I’m quite a newbie…

Viewing 7 replies - 1 through 7 (of 7 total)
  • Well, I found a solution myself, though when I upgrade to a new version I guess it will be lost… Anyways, I changed line 158 where the default values for the $post object appears to be set, from

    $post->post_status = 'draft';
    $post->post_status = 'private';

    It’s a hack, but it works. I hope a more robust solution is possible(?)

    $post->post_status = ‘draft’;

    Unable to find this line in 2.5.1 Did they change it again? any other ideas to do this. It must be such a simple switch, can’t imagine why it’s not a standard WP option

    Make all wordpress posts private by default ‘YES/NO’
    Make all wordpress pages private by default ‘YES/NO’

    Any other ideas ????

    Any leads on this?

    None. I have just quickly searched the code of 2.5.1 and I couldn’t find where the post object is being initialized.

    I’ll try to hunt it down tomorrow. I’m going upgrade to 2.6 though.

    I’d really like a plug-in that allowed me to restrict access by category that works with 2.5+.

    There are 2 recent plugins that do this. First is role scoper found here Good plugin but not a 5 minute job to set up. The other is in development at the moment called wp sentry found here Both these plugins are very new and both do exactly what has been missing for so long; a decent permission layer on wordpress! wp sentry is still growing features, and I think will be maturing soon. Scoper will do anything you want, but be prepared for a learning curve first. Hope that helps.

    I have hunted this one down in 2.7 (wordpress mu). it is under wp-admin/includes/post.php, in function get_default_post_to_edit().
    You will see:

    $post->ID = 0;
    	$post->post_name = '';
    	$post->post_author = '';
    	$post->post_date = '';
    	$post->post_password = '';
    	$post->post_status = 'draft';
    	$post->post_type = 'post';
    	$post->to_ping = '';
    	$post->pinged = '';

    Change $post->post_status = ‘draft’; to $post->post_status = ‘private’;

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Post private per default’ is closed to new replies.