How to Password-Protect a Post

A- A+

To password-protect a post, you need to give the option to the users. So to that, insert a text field in the form with the meta key post_password and insert this code snippet in your themes functions.php

How to password protect a post
[php] /**
* Set password for a post
* @param array $args
* @return array
function wpufe_post_passowrd( $args ) {
if ( isset( $_POST[‘post_password'] ) ) {
$args[‘post_password'] = $_POST[‘post_password'];

return $args;

add_filter( ‘wpuf_add_post_args', ‘wpufe_post_passowrd' );
add_filter( ‘wpuf_update_post_args', ‘wpufe_post_passowrd' );