Title: Visibility Public/Private
Last modified: August 30, 2016

---

# Visibility Public/Private

 *  [cre8ivedm](https://wordpress.org/support/users/cre8ivedm/)
 * (@cre8ivedm)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/visibility-publicprivate/)
 * I have reviewed topics in this thread and online but none seem to work.
 * I want to add an option to select either public or private post.
 * How can I add this?
 * [https://wordpress.org/plugins/wp-user-frontend/](https://wordpress.org/plugins/wp-user-frontend/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/visibility-publicprivate/#post-6381161)
 * 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 );
       }
       ?>
       ```
   
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/visibility-publicprivate/#post-6381162)
 * 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.

 * ![](https://ps.w.org/wp-user-frontend/assets/icon-256x256.gif?rev=2818776)
 * [User Frontend: AI Powered Frontend Posting, User Directory, Profile, Membership & User Registration](https://wordpress.org/plugins/wp-user-frontend/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-user-frontend/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-user-frontend/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-user-frontend/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-user-frontend/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-user-frontend/reviews/)

## Tags

 * [private](https://wordpress.org/support/topic-tag/private/)
 * [public](https://wordpress.org/support/topic-tag/public/)

 * 2 replies
 * 2 participants
 * Last reply from: [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/visibility-publicprivate/#post-6381162)
 * Status: not resolved