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
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().
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:
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 runningmd5()
.