Basically that’s the question – I wonder if set_transient()
overwrites/updates a transient option with the same key?
Leave a Reply
You must be logged in to post a comment.
Basically that’s the question – I wonder if set_transient()
overwrites/updates a transient option with the same key?
You must be logged in to post a comment.
Yes, key (prefixed with string identifying it as transient) is used as option name when value is inserted in database.
Maybe, but in my case set_transient() has failed when re-used without delete_transient() first. For some time I thought the problem was that the array I was saving as a transient was too large but that wasn’t it. I recommend that you delete the transient first if you’re having a problem.
I would concur with Jorge on the deletion first – I was having issues with
set_transient
trying to “overwrite” the same transient. Theset_transient
function was updating it, but the return value was false, not true.A call to
delete_transient
with its name just beforeset_transient
solved my issues andset_transient
would always return true.