Getting “The link you followed has expired” when adding custom post [closed]

The “The link you followed has expired” message is in the function wp_nonce_ays on line 2607 of wp-includes/functions.php. Apparently, the message was changed from “Are you sure you want to do this?” in 4.9.5. The wp_nonce_ays function is called by check_admin_referer if the nonce check fails. This is the only place in the WordPress code where this message is used. Therefore, if you ever see this message, you know that a nonce check is failing somewhere in your code.

When saving custom metadata, use the post_updated hook , rather than the save_post hook. For some reason, the save_post hook is invoked when a create post page is shown (i.e. before anything is saved). At this point the nonce has not been created, so the nonce check fails.

Leave a Comment