Use Transient API to cache queries for all posts in all categories?

You’re saving every query object for each category to the same transient. Because this happens fast and time frame is one day, you’re always getting the query object for the first category back. Make your transient name variable with the category, e.g. like this:

$query_category_posts = get_transient('cached_posts_' . $category );

Of course you then need to get the transient with the variable name.

Leave a Comment

tech