In Wordpress, how can I restrict users (based on Capabilities) from editing their published posts after a custom amount of time.
For instance, a user that can publish_posts
(authors) can not edit a their post if it is older than 3 days, and a user that can moderate_comments
(editors) can not edit any posts that are older than 20 days. Obviously, admins can edit anytime.
How is such thing possible?
This is the duplicate of a question on wordpress.stackexchange.com. I've copied my answer below.