Cannot connect APO to Wordpress plugin

Hello,

I am still having difficulties connecting my Wordpress domain to Cloudflare APO service.
I have fllowed all the steps listed in this article.

Running Cloudflare Plugin 4.2.1.
Wordpress 5.6.2
Not a subdomain.

I have activated the plugin, entered email and access token.
I have already been paying for the last 3 months for the service, but it still not working.

If I go to Cloudflare >> Optimized Delivery >> Automatic Platform Optimization for WordPress
The button is greyed out, and I cannot activate it.
It says “We did not detect WordPress running for your domain.”
I click ‘check again’ but nothing happens.

I can activate the slider plugin: https://snipboard.io/JflUts.jpg
But then it shows this in Cloudflare: https://snipboard.io/WSm4dC.jpg
Now if I wait a little and I refresh the plugin page, the slider is off again: https://snipboard.io/QItF1N.jpg

Does anybody have a suggestion how to fix this?

P.S. There is also NO save button in the plugin, is that correct? It also seems to have an issue with the version, see screenshot: https://snipboard.io/87XSVy.jpg

Is your domain/website added to Cloudflare?

Yes, the second screenshot was taken from my Cloudflare account using that specific domain.

Do you get any error response at Web Developer Console of your Web browser?

Do you use any caching plugin before trying to install the APO or no?

Maybe it is some issue related to Cloudflare.
@yevgen could you take a look at this?

Hah I checked Chrome Console on the back-end while running the Cloudflare plugin page.
Initially it seems fine but after loading I get the following 2 errors:

If I click the APO slider I get 4 more errors and they repeat every time I turn the slider on and off.
This is probably related to the issue. Do you know what is causing this?

(p.s. I use WP rocket but that should be compatible)

/wp-admin/admin-ajax.php?action=cloudflare_proxy 405
d.end @ compiled.js?ver=4.2.1:25
o @ compiled.js?ver=4.2.1:25
s @ compiled.js?ver=4.2.1:25
u @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:25
value @ compiled.js?ver=4.2.1:122
e.notifyAll @ compiled.js?ver=4.2.1:20
close @ compiled.js?ver=4.2.1:25
closeAll @ compiled.js?ver=4.2.1:6
perform @ compiled.js?ver=4.2.1:6
perform @ compiled.js?ver=4.2.1:6
perform @ compiled.js?ver=4.2.1:6
k @ compiled.js?ver=4.2.1:6
closeAll @ compiled.js?ver=4.2.1:6
perform @ compiled.js?ver=4.2.1:6
batchedUpdates @ compiled.js?ver=4.2.1:25
s @ compiled.js?ver=4.2.1:6
r @ compiled.js?ver=4.2.1:20
enqueueSetState @ compiled.js?ver=4.2.1:20
r.setState @ compiled.js?ver=4.2.1:6
l.onStateChange @ compiled.js?ver=4.2.1:20
l @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
dispatch @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:25
d.callback @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
r.emit @ compiled.js?ver=4.2.1:25
n.onreadystatechange @ compiled.js?ver=4.2.1:25
XMLHttpRequest.send (async)
d.end @ compiled.js?ver=4.2.1:25
o @ compiled.js?ver=4.2.1:25
i @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:25
d.callback @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
r.emit @ compiled.js?ver=4.2.1:25
n.onreadystatechange @ compiled.js?ver=4.2.1:25
XMLHttpRequest.send (async)
d.end @ compiled.js?ver=4.2.1:25
o @ compiled.js?ver=4.2.1:25
i @ compiled.js?ver=4.2.1:25
p @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:25
dispatch @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:25
dispatch @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:25
dispatch @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:25
d.callback @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
r.emit @ compiled.js?ver=4.2.1:25
n.onreadystatechange @ compiled.js?ver=4.2.1:25
XMLHttpRequest.send (async)
d.end @ compiled.js?ver=4.2.1:25
o @ compiled.js?ver=4.2.1:25
i @ compiled.js?ver=4.2.1:25
f @ compiled.js?ver=4.2.1:6
(anonymous) @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:25
dispatch @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:25
dispatch @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
(anonymous) @ compiled.js?ver=4.2.1:25
value @ compiled.js?ver=4.2.1:25
performInitialMount @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:6
performInitialMount @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:6
performInitialMount @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:6
performInitialMount @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:6
performInitialMount @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:6
performInitialMount @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:25
mountComponent @ compiled.js?ver=4.2.1:6
a @ compiled.js?ver=4.2.1:20
perform @ compiled.js?ver=4.2.1:6
u @ compiled.js?ver=4.2.1:20
perform @ compiled.js?ver=4.2.1:6
batchedUpdates @ compiled.js?ver=4.2.1:25
i @ compiled.js?ver=4.2.1:6
_renderNewRootComponent @ compiled.js?ver=4.2.1:20
_renderSubtreeIntoContainer @ compiled.js?ver=4.2.1:20
render @ compiled.js?ver=4.2.1:20
(anonymous) @ compiled.js?ver=4.2.1:25
t @ compiled.js?ver=4.2.1:1
(anonymous) @ compiled.js?ver=4.2.1:1
(anonymous) @ compiled.js?ver=4.2.1:1
Show 48 more frames
VM1451:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.callback (compiled.js?ver=4.2.1:6)
    at compiled.js?ver=4.2.1:25
    at d.callback (compiled.js?ver=4.2.1:25)
    at d.<anonymous> (compiled.js?ver=4.2.1:25)
    at d.r.emit (compiled.js?ver=4.2.1:25)
    at XMLHttpRequest.n.onreadystatechange (compiled.js?ver=4.2.1:25)

I recommend enable APO with API call using your zone credentials:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/settings/automatic_platform_optimization" \
     -H "X-Auth-Email: [email protected]" \
     -H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
     -H "Content-Type: application/json" \
     --data '{"value":{"enabled":true,"cf":true,"wordpress":true,"wp_plugin":true,"hostnames":["www.example.com","example.com"]}}'

Once completed, clear WP Rocket server cache. Please note that only way to integrate with WP Rocket is to disable WP Rocket’s Cloudflare addon.

1 Like

Thank you Yevgen. I usually do not work with API calls etc.
I suppose the whole reason APO is on the market; to have a clear and simple solution? This seems to run counter to that.
We have disabled the WP rockets cloudflare addon already.

Do you know what the error messes in Console mean?

I saw similar error callstack before, some folks reported it was due to other existing plugins running on the origin. Try disabling all of them apart from Cloudflare, I’m pretty sure it will be resolved then.

1 Like

OK… say I find a plugin that has an conflict with it.
Would it be possible to troubleshoot this with help of Cloudflare?
Or would this simply mean disabling this plugin for all time?

If I would run the API call, would that not have the same issues?

this steps helped to resolve APO setup for another customer with similar problems:

Hi @yevgen ,

thank you for the suggestion.
But I cannot even disable APO in the card; or enable it.
It basically is always off and throws an error.
When I turn it on it throws more errors, and it is never saved.
So I don’t think moving the slider does anything (but errors).

Or did I misunderstand?

This topic was automatically closed after 31 days. New replies are no longer allowed.