Title: Programmatically enable/disable Protected Status
Last modified: October 1, 2021

---

# Programmatically enable/disable Protected Status

 *  Resolved [DCuserName](https://wordpress.org/support/users/dcusername/)
 * (@dcusername)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/programmatically-enable-disable-protected-status/)
 * Hi, can anyone point me in the right direction for a way to update the protected
   status of a site programmatically, via a hook, updating a meta value, database
   entry, etc.?
 * Basically I need to hook into a custom post save, and change the password status
   based on a submitted form value. Possible?
 * Thanks,
    David

Viewing 1 replies (of 1 total)

 *  Thread Starter [DCuserName](https://wordpress.org/support/users/dcusername/)
 * (@dcusername)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/programmatically-enable-disable-protected-status/#post-14930115)
 * Actually this was simpler than I thought, for anyone who needs it:
 * update_option(‘password_protected_status’, 0); // Protected Status off
 * update_option(‘password_protected_status’, 1); // Protected Status on

Viewing 1 replies (of 1 total)

The topic ‘Programmatically enable/disable Protected Status’ is closed to new replies.

 * ![](https://ps.w.org/password-protected/assets/icon-128x128.gif?rev=2824217)
 * [Password Protected — Lock Entire Site, Pages, Posts, Categories, and Partial Content](https://wordpress.org/plugins/password-protected/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/password-protected/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/password-protected/)
 * [Active Topics](https://wordpress.org/support/plugin/password-protected/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/password-protected/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/password-protected/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [DCuserName](https://wordpress.org/support/users/dcusername/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/programmatically-enable-disable-protected-status/#post-14930115)
 * Status: resolved