WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#27794 closed enhancement (wontfix)

Always use visibility:private when creating new posts

Reported by: SkyHiRider Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.2
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

I am using Wordpress as a private information repository.

I have to manually switch the post type from public to private EVERY SINGLE TIME that I create a new post and there isn't an option to set all posts to private by default.

I can change it in the core files but that is hardly a solution, as I will have to apply the change every time I update.

Could you add an option to select the default type of post (public or private) in the next version of Wordpress?

Change History (6)

#1 @SergeyBiryukov
7 years ago

  • Component changed from Security to Posts, Post Types
  • Type changed from feature request to enhancement

A workaround:

function set_default_post_status_27794() {
	if ( 'auto-draft' === $GLOBALS['post']->post_status ) {
		$GLOBALS['post']->post_status = 'private';
	}
}
add_action( 'do_meta_boxes', 'set_default_post_status_27794' );

#2 follow-up: @SkyHiRider
7 years ago

Thanks, I have already implemented it. But what happens when I update Wordpress, will the changes be lost?

Can you add "Default Post Visibility" to "Writing Settings" ( /wp-admin/options-writing.php)in the next Wordpress version ?

Last edited 7 years ago by SkyHiRider (previous) (diff)

#3 in reply to: ↑ 2 @knutsp
7 years ago

  • Keywords close added

Replying to SkyHiRider:

Thanks, I have already implemented it. But what happens when I update Wordpress, will the changes be lost?

The function should preferably be placed in a plugin and will run on every pageload (nn the editor pages). It might also go into functions.php of a (child) theme that will never be updated automatically.

Can you add "Default Post Visibility" to "Writing Settings" ( /wp-admin/options-writing.php)in the next Wordpress version ?

I doubt that, as decisions, not options, is the philosophy. The strength of WordPress is the ability to do such things through hooks.

#4 @mordauk
7 years ago

This seems like plugin territory to me.

#5 @UmeshSingla
7 years ago

The workaround seems to be the good solution, making it default in core is inappropriate.

#6 @SergeyBiryukov
7 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.