Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8035059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:12:09+00:00 2026-06-05T02:12:09+00:00

WordPress has a nonce mechanism whereby a plugin can emit a nonce into client-side

  • 0

WordPress has a nonce mechanism whereby a plugin can emit a nonce into client-side code, and then verify the nonce when the client communicates back to the server.

I looked in the source code for wp_verify_nonce() (in wp-includes/pluggable.php), and see that it returns true if the nonce is 24 hours old or less.

Is it possible for me to create a nonce that can be verified to be … let’s say… .1 minute old?

How?

I think there is a way via add_filter() and nonce_life. But I don’t want the nonces everywhere to have a short life. I want only the nonce used by my plugin to have a short life.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:12:11+00:00Added an answer on June 5, 2026 at 2:12 am

    I found little documentation on the wordpress nonce.

    While the code itself is not very complicated, and there is a way to simply replace the wp_verify_nonce() function, I believe the nonce is used in many places throughout wordpress, and I’m not confident that my replacement will not break other things.

    Lacking any helpful suggestions from here or other places, I abandoned the idea of making my nonce expire more quickly and just added my own nonce/timestamp field.

    The plugin I am writing generates a nonce and then embeds it in a script block, which is then rendered in the webpage. When the Javascript in the page communicates back to the wordpress admin-ajax.php, it sends back the nonce. WordPress then verifies the nonce with wp_verify_nonce() and allows the request if the nonce has not expired – either 12 or 24 hours as you wish. This check also verifies the identity of the caller.

    What I did was simply generate another nonce, an encrypted timestamp. It gets embedded into the javascript script block, in the same way as the WP nonce. It gets retransmitted in the same way, and verified in a similar manner: I decrypt and check that the timestamp is “recent”.
    The difference is that my plugin controls the verification so I can set the threshold for “recency”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

WordPress has been installed as a blog into osCommerce. I'm trying to get the
Wordpress has a filter that automatically add paragraphs to posts. I can remove this
My client already has a Wordpress blog/webshop. Now she wants an extra system, that
I'm creating a wordpress plugin and I was wondering if wordpress has any function
I am using Wordpress and it has code like this: <?php if (is_user_logged_in()) {
I started working on a wordpress theme for a client that has some strange
So i'm writing a plugin for wordpress and one of the pages has information
Wordpress has 2 columns in its *wp_posts* table post_date (the actual date post was
wordpress has a good support for images in general. to get new image sizes,
My mobile site (tiny custom CMS inspired by wordpress) has a homepage, blog page,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.