shazahm1 / Display-Posts-Shortcode-Remote

An extension for the Display Posts Shortcode plugin which adds a shortcode for displaying posts from a remote WordPress site utilizing the WP REST API.
9 stars 6 forks source link

Single cache used regardless of shortcode parameters #2

Closed billerickson closed 5 years ago

billerickson commented 5 years ago

I first created a listing using [display-posts-remote url="https://www.billerickson.net"].

I then tried customizing the results, limiting to a category and removing images:

[display-posts-remote category_id="319" image_size="false"]

But the results were unchanged. I dug in a bit and it looks like you're using the URL as the cache key. This is the top level URL to the site, not something unique to the specific shortcode.

I recommend you generate a unique cache for each instance of the shortcode. Include the arguments in cacheKey() somehow, maybe json_encode them and append to the URL before running md5().

billerickson commented 5 years ago

I'm sorry, I take that back. It looks like you're using the specific REST API URL that includes all the shortcode parameters already.

Now to figure out why my results aren't changing, haha.