Viewing 2 replies - 1 through 2 (of 2 total)
  • you may be able to create a custom field in the form builder, in my example it’s called “post_status”, then give it a selectable value, like “private: which triggers a conditional in the post template to update the status in for the post.

    untested..

    <?php
    (get_post_meta($post->ID,'post_status',true) )
    if($value=='private' {
    
    // Update post
      $my_post = array();
      $my_post['ID'] = $id;
      $my_post['post_status'] = 'private';
    
    // Update the post into the database
      wp_update_post( $my_post );
    }
    ?>

    something is wrong with that, but I tested with this and it worked.

    <?php $your_custom_field = get_post_meta($post->ID, 'poststatus', true);
    if ( $your_custom_field == 'private' ) {
    
    // Update post
      $my_post = array();
      $my_post['ID'] = $id;
      $my_post['post_status'] = 'private';
    
    // Update the post into the database
      wp_update_post( $my_post );
    }
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Visibility Public/Private’ is closed to new replies.