Display Posts Shortcode – is there a refresh gap?
-
Hi, I have created a page which uses the display posts shortcode for a particular category. I find that if I either add the category to a post or remove the category from a post, there is a time delay, certainly minutes and not seconds before the new position is reflected in the list of posts displayed on the page. Do you have any idea how long this time delay is normally as I’m trying to sell the idea and it’s a hard one to demo live (unless I go into the page and regenerate it which kind of kills the impact). For example, I removed a category from a post approx 5 minutes ago and it is still appearing on the page.
Any advise, gratefully received.John
The blog I need help with is: (visible only to logged in users)
-
Hi John,
Without doing a force refresh, the time delay would actually be rather unpredictable as it depends entirely on the behavior set in your local browser. Once you save the change in your post, the next time its data is called the change will be reflected.
In the use case you describe, the changed category will reflect immediately after the post is changed and you click “update,” but your browser is loading a cached version of the page because it’s already saved that it called that post up before.
This behavior is the same whether you’re implementing the display post shortcode, or if you have a page defined as the default Posts page.
Best,
-Alex G.
-
Hi Alex, I have done force refreshes, logged on to different browsers, cleared the cache on the browser and even logged on to a diferent PC and the page still displays an entry for a post which is no longer belonging to the category which is in the shortcode i.e. LatestPost,
[display-posts category="LatestPost" posts_per_page="3" include_date="true" order="DESC" orderby="date" display-posts wrapper="ol" date_format = "l, F j, Y G:i" ]There is no similar problem when simply displaying the automatically generated page for a category, e.g. http://esbremit.wordpress.com/category/publication-relevant/year-of-incident-2014/november-2014/
In these cases if a post is classified or unclassified as a particular category it appears / disappears from the page immediately.It’s like as if the page associated with the short code has been cached on WordPress’s server and isn’t being refreshed because there has been no change made to the shortcode which is generating the page.
I also found that in the case of the short code pages, the category has to be explicitly allocated to the post, i.e. if the post is categorised with a child category and the shortcode uses a parent category, then the post does not appear on the page generated.
John
-
Hi John,
Very sorry here, it appears I was indeed mistaken.
I tested out your use case and I’ve been able to replicate the issue. The intended behavior for display-posts is to reflect changes in the same manner that a default Posts page does, but I guess I’ve just never tested it at this frequency of changes.
Digging into the code, it appears that display-posts shortcode does operate from a cache which refreshes every hour. Anything less than an hour would be triggered by changes elsewhere, like when you edit the page as you suggested.
If you’re looking for a faster refresh time, would you be able to find use in the Category Archives pages, for example this one for the category of latestpost:
http://esbremit.wordpress.com/category/latestpost/
You said you’re demo’ing the display-posts shortcode live — are you teaching a class of some sort, or what is the functional end goal of using display-posts?
Please let me know and I’d like to help investigate other workarounds.
Best,
-Alex G.
-
Thanks Alex, the attraction with the shortcode page is that it gives you a nice listing of the posts whereas the auto generated category page shows the posts outputting one after the other in full. anyway, at least I know now that there can be a delay of up to an hour before the cache is cleared at the wordpress.com end. Do you know anything re the fact that the category involved has to be explicitly associated with the post rather than displaying posts belonging to a parent category when the posts are associated with children.
John
-
Hi again,
It appears the shortcode is only built to filter these posts with explicit categories being entered in its arguments. It doesn’t include any kind of search into nested categories. I’m not sure if this was intended by design to not include child categories.
I’ve submitted a feature request to the developers to include child categories when a parent category is selected, and I’ll be happy to let you know if they are able to implement that.
Best,
-Alex G.
- The topic ‘Display Posts Shortcode – is there a refresh gap?’ is closed to new replies.