Instead of adding the nonce_life
filter and then immediately removing it, try telling WordPress that the lifetime for your nonce is 30 seconds.
add_filter( 'nonce_life', 'wpse426626_my_nonce_lifetime', 10, 2 );
/**
* Sets the nonce lifetime for the creacomments nonce.
*
* @param int $lifetime The nonce lifetime.
* @param string $action The nonce action.
* @return int The filtered nonce lifetime.
*/
function wpse426626_my_nonce_lifetime( $lifetime, $action ) {
if ( 'creacomments' === $action ) {
// Sets the creacomments lifetime to 30 seconds.
$lifetime = 30;
}
return $lifetime;
}
Then use the nonce as you already are.
Related Posts:
- Do I have to have a nonce for a custom comment field?
- How do I comment out a block of tags in XML?
- R: Comment out block of code
- How to rearrange fields in comment_form()
- How do I delete all comments from a specific old blog post?
- Removing the “Website” Field from Comments and Replies?
- How to enable comments for pending and draft posts?
- How to load and show comments with AJAX instead of pagination?
- Comments not appearing at all
- A plugin where users can comment with Facebook or Twitter or OpenID [closed]
- Comment Count for each Comment Author
- Show comments from multiple post IDs in comment template
- Comment form validation
- Sticky Comments
- Comments number message in password protected post
- Disable Comments Feed
- Use rich text editor in comments?
- Add a custom class to awating comments
- How to add custom comment fields but *only on the comment reply form*?
- I have tried using Plugins to remove 72K comments with no success
- Show only posts which can be commented
- What should I hook to add extra fields to comments?
- Get a variable field of all comments of current post
- Average Score of all ratings in comments
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, func
- How To Disable Comments On New Page
- Report spam button
- Recent comments from my blogs only
- show if comment is in moderation
- Disable or Enable Comments on Front end [closed]
- Change username to nickname in comment section
- Deleting the attached “comment replies” when trashing a comment
- How can I get a list of comments by target
- Load comments.php template outside the post loop
- Auto-fill Custom comment fields
- Highlighting the current users comment
- How to make all the posts commentable by default? Imputs in Settings/Discussions are not saved
- How to auto empty comment trash after X days
- comments.php keep comment date/time but remove date/time’s #hyperlink
- how to change comment author’s link from user’s website to author’s page(author.php)?
- Add class to comment form div when comment-reply button is clicked
- Disabling archives, search results, comments, etc?
- Pagination Comments Doesn’t Show
- Control panel loads slowly due to 2 slow queries on comment table
- Display complete comment section via post ID
- WordPress comments – how to check if comment still needs to be approved?
- PAIN. Comments Pagination
- How to retain comment text on comment form after login/registration?
- After Submitting Comment Form Shows an Empy Page in WordPress
- Unique User for all visitor, but possibility to comment with unique name
- comments_array filter doesn’t work in some themes
- Redirect when click on “response” in comment section
- Troubleshooting Emoji in Comments
- strange behavior with comment position
- Why could my comment_form variable not be working?
- How to block comments and pings?
- Batch approve comments
- Disable comments and pingbacks on old custom post types
- Can I turn off further comments on a single page?
- How to remove the number of a comment in the url slug?
- How to allow duplicate comments?
- How are readers authenticated for leaving comments?
- Are there some caveats for using guids for FB comments
- How can I grab and show the reader comments of my site
- WordPress comments – delimiter “/” not found
- Make email not required comments.php
- My posts show 2 comment forms
- Give subscribers the option to post anonymously
- Thesis Theme Custom Loop
- Sync comments between two WP installs
- Show image next to the comment author if have certain role
- Displaying comment counts in WP Gallery thumbnail view
- Removing comment option
- pre_comment_content filter not working using IntenseDebate Enhanced moderation
- How t Remove Labels from comment Box
- SQL command to delete “pending comments” doesn’t work…?
- How to remove a span class?
- Allow comments only for custom post type
- Comment author profile image
- Comment Form Fields when user logged in
- How can I enable comments on category page but not home page?
- wp_mail doesnt work inside transition_comment_status
- js solution to… Commentor can only post one comment BUT can reply to their comment tree unlimited [duplicate]
- How can I eliminate all comments going into moderation?
- Not receiving any e-mails after new comment
- How to change comment-page-1#comment-25 to any string?
- Current user comments + post title
- I need to delete all posts from my homepage & create a static front page [closed]
- Is there a better way to check for a new comment?
- Add comment meta
- Comments from mobile apps & Disqus
- Commentform – Hightlight invalid fields instead of prompting towards error page
- In list with recent coments – only show one comment per page/post (latest comment)
- Outputting complete custom comment form
- member login using photo
- Changing comment_count to views
- Pagination comments
- Rating based off of number of comments or views
- How to hide newly added comments after 24h?
- Posting a comment on a blog post loads another blog post and comment is linked to the new blog post