WordPress.org

Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 7 months 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:

Description

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 18 months ago.

Download all attachments as: .zip

Change History (5)

#1 follow-up: @spacedmonkey
18 months 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
18 months ago

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

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

#3 @desrosj
17 months ago

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

#4 @bordoni
7 months 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.