0

Hello any idea how to make a page I publish to chage the password after 2 days automatically (I am looking for a plugin or something else I can implement)? Right now I am using the pages to present something to my clients but then I want to not have access to it after 2 days. Thank you.

0

Welcome to WPSE. Plugin recommendations are considered off-topic here, so here's an action approach to the problem.

You could use WP Cron to schedule a daily event for resetting page password. You can use wp_schedule_event() to schedule your custom event.

In your event callback, use first WP_Query with password parameter to get all protected pages. Then loop through found pages and update their passwords with wp_update_post as password is saved in the post_password post property / posts table column.

If you want the new password to be something random, you can for example use wp_generate_password() to generate it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.