[wp-trac] [WordPress Trac] #34322: set_transient and get_transient don't seem to be working for some users since WP 4.3
WordPress Trac
noreply at wordpress.org
Mon Oct 19 03:57:28 UTC 2015
#34322: set_transient and get_transient don't seem to be working for some users
since WP 4.3
--------------------------------+------------------------------
Reporter: smashballoon | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 4.3
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------------+------------------------------
Comment (by smashballoon):
Thanks, I've read through that thread a few times before and although it
seems related it only references get_transient not deleting broken
transients any more, which I don't think should be causing this issue. As
far as I can tell nothing has been changed which should prevent the
following script from working:
{{{
<?php
$transient = get_transient( 'test_transient_expiration' );
if( ! empty( $transient ) ) {
echo 'From Database. Last updated: ' . json_decode(
json_encode($transient) )->headers->date;
} else {
$facebook_data = wp_remote_get(
'https://graph.facebook.com/cnn/posts?access_token=ACCESS_TOKEN' );
set_transient( 'test_transient_expiration', $facebook_data, 1800 );
echo 'From URL. Last updated: ' . json_decode(
json_encode($facebook_data) )->headers->date;
}
?>
}}}
We use the same code in our plugin, and we've had lots of different users
report an issue with it not working on their sites anymore. I've even
logged into a few sites and set this exact script up on a blank test page
and the transient will continually return as true and never expires unless
manually deleted using delete_transient.
I know this probably isn't a particularly helpful bug report but I wanted
to report the issue in case someone was able to replicate it or
experienced the same problem. For now I'm going to try and come up with an
alternative solution for caching the data instead of relying on
set_transient and get_transient as I have been up until now.
John
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34322#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list