Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I don't know how to make a plugin so I can't do what's suggested here How can I make it so the Add New Post page has Visibility set to Private by default?

so what's alternative ?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Found this on WordPress forums:

You can just add this to functions.php. I've tested once and seemed to work fine.

function default_post_visibility(){
global $post;

if ( 'publish' == $post->post_status ) {
    $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 {
    $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
}
add_action( 'post_submitbox_misc_actions' , 'default_post_visibility' );
share|improve this answer
    
Thank you very much just come back today and see your usefull answer :) –  user310291 Oct 30 '11 at 15:51
add comment

The alternative would be to find someone else to make a plugin.

If you're using WordPress.com (meaning you can't install arbitrary plugins on your site), then you're out of luck. But for a self-hosted WordPress installation, you'll need to write a plugin and install it on your site. There are no alternatives when it comes to adding custom functionality.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.