Thread Starter
mameha
(@mameha)
I implemented the change above myself.
Open this file: /wp-admin/includes/meta-boxes.php
Then change this code:
if ( 'private' == $post->post_status ) {
$post->post_password = '';
$visibility = 'private';
$visibility_trans = __('Private');
} elseif ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
$visibility = 'public';
$visibility_trans = __('Public, Sticky');
} else {
$visibility = 'public';
$visibility_trans = __('Public');
}
to this:
if ( 'publish' == $post->post_status ) {
$post->post_password = '';
$visibility = 'public';
$visibility_trans = __('Public');
} elseif ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
$visibility = 'public';
$visibility_trans = __('Public, Sticky');
} else {
$visibility = 'password';
$visibility_trans = __('Password protected');
}
This sets the default to Password Protected, not Public or Private.
Credit for the code to the poster on the wordpress support page linked above.
Hi mameha,
Hacking core files is a terrible idea. Are you going to keep up with those changes every time you update WordPress? You should look into a JavaScript solution instead.
I don’t plan to add this feature to Global Post Password as the plugin is now in hibernation (I haven’t used it myself in over a year).
John