Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#46365 closed enhancement (invalid)

Add a filter to `wp_create_nonce` to allow expired nonces to regenerate if the page is cached

Reported by: hailite Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.3
Component: Cache API Keywords: has-patch
Focuses: Cc:


By default, if a page is cached, the related nonce will be cached too. If the page cache's TTL is over 24 hours, the nonce will expire during that time.

By giving the nonce generation function a filter before returning the value, a nonce can have the ability to regenerate for the cache plugins that have ESI or partial/fragment cache functionality.

Attachments (1)

wp_create_nonce.diff (568 bytes) - added by hailite 3 years ago.

Download all attachments as: .zip

Change History (5)

#1 follow-up: @spacedmonkey
3 years ago

  • Keywords reporter-feedback needs-unit-tests added
  • Version changed from trunk to 2.0.3

@hailite The wp_create_nonce is plugable, as you can replace it all together in your own code. If you need this filter, then you can register your own function. Why does this filter need to be core?

#2 in reply to: ↑ 1 @hailite
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

@spacedmonkey Good point. Will override that function. Thanks.

#3 @desrosj
3 years ago

  • Keywords reporter-feedback needs-unit-tests removed
  • Milestone Awaiting Review deleted

#4 @bordoni
2 years ago

@spacedmonkey I feel like we should add this filter because even if it's pluggable, it creates problems if multiple plugins overwrite it.

It would for sure allow better control over the creation of nonces.

Note: See TracTickets for help on using tickets.