Wp-rocket: Not clearing cache for new posts when using XML-RPC

Created on 2 Oct 2017  路  15Comments  路  Source: wp-media/wp-rocket

Unfortunately WP Rocket doesn't check what's happening when using XML-RPC: https://github.com/wp-media/wp-rocket/blob/fdee41ec2db637d2d4afc1dbd75f5b739b73661f/wp-rocket.php#L92

So I a user uses tool such as Open Live Writer to post via XML-RPC protocol, the cache is not cleared.

I see where this code was added: https://github.com/wp-media/wp-rocket/commit/e0476e16edad7ae339a5d52b2c0bab2ff2986afd

Could you please improve this to check what is the action in XML-RPC and only ignore it it it doesn't originate from a logged in user, or something like that?

Thanks!
Martin

community cache grooming low bug

All 15 comments

+1 from me - I write via MarsEdit and currently have to log into the site to bust the cache by hand after writing, which is a bit annoying.

Hello @infovore,

I got a reply from WP Rocket support 9 days ago:

it鈥檚 a valid concern, and thus, something he will eventually be looking into, but we don鈥檛 have a specific timeline on it yet.

Thanks,
Martin

@foliovision Shame. It feels like a fairly core component: busting cache based on content change no matter where that content change comes from. But I'll be honest and admit I'm not super-familiar with the tangle that is the core Wordpress API, so guess I'd better wait.

Hello WP Rocket,

this was still not fixed and now we look like fools in front of our client.

Thanks,
Martin

Hello WP Rocket,

what's the problem with having the plugin work for XML-RPC?

Thanks,
Martin

We want it to work with XML-RPC, but we previously had some unwanted side effects, like in this case: https://github.com/wp-media/wp-rocket/issues/337

XML-RPC and WP Rocket interaction needs to be tested further to make both work together without side effects.

But this is something that is used so little by our customers that it's currently low on our priority list, and I currently have no way to tell you when we'll look into it.

I appreciate it's not used much by your customers. However, it is literally out-of-the-box functionality with WordPress, which WP-Rocket is managing to break - but does not _document_ the fact that it inhibits out-of-the-box functionality. So if it's clearly a WONTFIX for you, you should make it clear in the product documentation that it doesn't actually let you use certain default WordPress features.

(I use Rocket for one site of mine; other sites use other caching plugins, which seem to have no issue with this).

As far as I know, it doesn't break any WordPress core functionality. Rather, WP Rocket breaks itself, as it is not clearing its cache when a content is updated from XML-RPC.

This is not a wont fix, as you can see from the tags I added. But as I stated, it is not a priority either.

Hello Tabrisrp,

I just tested this on WordPress 4.9 with WP Rocket 2.11.6. As soon as I commented these two lines:

https://github.com/wp-media/wp-rocket/blob/master/wp-rocket.php#L101
https://github.com/wp-media/wp-rocket/blob/master/wp-rocket.php#L169

...it started to work - now when I publish a new article using XML-RPC the homepage cache is purged properly.

I checked https://github.com/wp-media/wp-rocket/issues/337 and I see there was a suggested fix for the issue as well. So I put that together with my fix and create a pull request:

@infovore If you have a minute please reinstall WP Rocket from https://github.com/foliovision/wp-rocket/archive/xml-rpc-fix.zip and let us know if it solved your XML-RPC posting issues.

Thanks,
Martin

@foliovision Hi, Martin. So: removing that return whenever it's an XML-RPC request solves this. I appreciate not wanting to trip the cache on random XML-RPC requests for sites that don't use it, so it feels like wrapping that in some sort of configuration option would make most sense. I'm afraid I don't know the Wordpress API well enough to submit a PR.

That said, I had to apply a similar change to Rocket 2.10.x, because the changes to composer use in 2.11.x clash with the fact I already use composer in a specific way to deploy my site - Rocket 2.11.x just 500s my entire site (delightfully). I'll mention that in another issue.

@infovore Removing that return statement means WP Rocket will continue loading. It won't just purge the cache for no reason. It will still detect when a post was updated and only clear the cache then.

Although I see that hypothetically it could be possible to send some weird XML-RPC request which would force WP Rocket to clear the cache, I don't think it's very likely.

WP Rocket clears its cache way too often anyway, here is our take on it: https://github.com/wp-media/wp-rocket/issues/478

Related ticket: https://secure.helpscout.net/conversation/1406680709/234339?folderId=3864740

@arunbasillal could you please take a look. Should we reopen this issue?

Conversation in Slack about this 馃憜: https://wp-media.slack.com/archives/C43T1AYMQ/p1611832911041000

@Tabrisrp Can you please take a look? The reported issue seems to be the exactly same. It was never fixed in the first place?

We merged the proposed fix in #773, so it was supposed to be, as reported by the committer of the PR.

If we want this to be investigated further, it needs to be re-opened + grooming request.

Was this page helpful?
0 / 5 - 0 ratings