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.
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.
Share Improve this question asked May 12, 2020 at 7:55 GeorgeMatGeorgeMat 11 Answer
Reset to default 0Welcome 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.