mercredi 20 août 2014

transient api and deletion of transient after post update?


Vote count:

0




I have this function that uses the transient API in Wordpres



function majortom() {

if (get_transient('realcontent') === false) {
$content = 'whatever';
set_transient_('realcontent', $content, 3600);
}
else {
$content = get_transient('realcontent');
}

echo $content;

}


The function (majortom) is added (hooked) to a metabox with add_meta_box() inside of a custom post type (edit view in admin)


When I update the post I want the transient (realcontent) to be deleted. I tried to use:


delete_transient('realcontent') inside of a save_post hook, but it doesn' seem to work.



asked 18 secs ago







transient api and deletion of transient after post update?

Aucun commentaire:

Enregistrer un commentaire