• Resolved Noel Forte

    (@fortissimo95)


    Hi-

    I’m new to the transients API, and am trying to set up a page that runs a series of loops and database queries, outputs them to HTML as a variable, saves it to the database, and then can be accessed at any time.

    If a user gets updated, I need the queries to be re-run and a new copy of the page to be generated.

    I’ve already taken a look at the API page, and have gotten it pretty close to what I want, however, when I save a user into the database, the transient just gets cleared by a function/action I have set up in functions.php. However, a new page doesn’t get re-generated. Help?

    Thanks,

    Noel

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Noel Forte

    (@fortissimo95)

    Hey,

    I’ve done some more digging, and discovered what the finer details of the issue I’m having are.

    I have the transient set up so that when a user updates their own profile, or the profile of another user, the transient gets deleted. However, even with the transient non-existent in the database, WordPress continues on its way, loading the data as if nothing had happened, although the transient is in reality, gone.

    Why is this happening?

    Moderator bcworkz

    (@bcworkz)

    WP maintains a cache of DB queries. The cache is normally flushed when you delete data, but for transients maybe you need to explicitly flush. I don’t know any of this for a fact (except that a cache exists). I’m speculating, it’s the only explanation I can think of.

    Thread Starter Noel Forte

    (@fortissimo95)

    Thanks for the reply! wp_flush_cache(); was what did it. By deleting the transient and flushing, I was able to get the transient to regenerate.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Working with Transients’ is closed to new replies.