「wp-includes/functions.php」に次のコードを追加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
/** * Set default state to private' when creating new draft article */ add_action( 'post_submitbox_misc_actions' , 'post_status_default_private' ); function post_status_default_private() { global $post; if ( $post->post_status == 'publish' ) { $visibility = 'public'; $visibility_trans = __('Public'); } elseif ( !empty( $post->post_password ) ) { $visibility = 'password'; $visibility_trans = __('Password protected'); } elseif ( $post->post_type == 'post' && is_sticky( $post->ID ) ) { $visibility = 'public'; $visibility_trans = __('Public, Sticky'); } else { $post->post_password = ''; $visibility = 'private'; $visibility_trans = __('Private'); } ?> <script type="text/javascript"> (function($){ try { $('#post-visibility-display').text('<?php echo $visibility_trans; ?>'); $('#hidden-post-visibility').val('<?php echo $visibility; ?>'); $('#visibility-radio-<?php echo $visibility; ?>').attr('checked', true); } catch(err) { } })(jQuery); </script> <?php } |
コメント