Hi @juliane16
I hope you’re well today!
This isn’t currently possible, I’m afraid. Posts can be set to be “draft” or “pending review” instead of “published” (so they are not instantly publicly available) but there’s no option to password protect them out of the box.
It may be doable with a bit of custom code but I need to consult it with our developers. I’ve already asked them and am awaiting feedback so please keep an eye on this ticket and I (or one of my colleagues) will update you here as soon as we get more insight into this.
Best regards,
Adam
Hi @juliane16
I just got response and a bit of custom code that should help here:
<?php
add_action( 'forminator_post_data_field_post_saved', function( $post_id ){
wp_update_post( array(
'ID' => $post_id,
'post_password' => 'pass123' )
);
} );
To add it to the site:
1. create an empty file with a .php extension (e.g. “forminator-post-password-protect.php”)
2. copy and paste shared code into that file
3. replace pass123 in this line
'post_password' => 'pass123' )
with the password that you want to be set for those posts
4. save the file
5. upload the file to the “/wp-content/mu-plugins” folder of your site’s WordPress installation; note: if there’s no “mu-plugins” folder directly in “wp-content”, just create an empty one first.
There’s no need for any activation or other configuration and it should work out of the box then.
Best regards,
Adam
Thread Starter
Juliane
(@juliane16)
Hi,
Thanks, it works! I set my question as resolved.