[wp-trac] [WordPress Trac] #64327: WordPress transients are not cleared

WordPress Trac noreply at wordpress.org
Mon Dec 1 21:08:58 UTC 2025


#64327: WordPress transients are not cleared
--------------------------------+------------------------------
 Reporter:  programmin          |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  2nd-opinion         |     Focuses:
--------------------------------+------------------------------
Changes (by peterwilsoncc):

 * keywords:   => 2nd-opinion
 * version:  6.8.3 =>
 * component:  General => Options, Meta APIs


Comment:

 As noted in the documentation, there are limits to the length of transient
 names:

 * Single site transients
 ([https://developer.wordpress.org/reference/functions/set_transient/
 set_transient] are limited to 172 characters or fewer
 * Network transients
 ([https://developer.wordpress.org/reference/functions/set_site_transient/
 set_site_transient] are limited to 167 characters or fewer

 For your purposes, I'd recommend naming the transients with a hash of the
 JSON date.

 I think the bug in this situation is that WordPress isn't catching the
 names are too long ans this is causing them not to be deleted. For long
 names WordPress could be updated to either:

 1. store the names as a hash
 2. throw a warning and not set the transient

 My leaning is towards the second option as renaming the transient without
 notifying the developer would be confusing (the names would not appear in
 the database as expected) but I'll let others weigh in.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64327#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list