/wp-json/ missing in REST API URL

[ad_1]

Hi @stefacchio,

Could you provide more details about the problem? Where has the /wp-json part been removed? removed in cached results? or general?

Thread Starter
Stefano

(@stefacchio)

Hi @m_uysl, mmmh I didn’t understand exactly your question.
When I enable the plugin with all enabled such as page cache, file css and js optimization, all blocks that do a fetch request with WP REST API, use the url without /wp-json/ getting a 404 error.
Instead with plugin deactivated the fetch url is correct with /wp-json/ and all work fine.

See following images

Could you share the link to the page you see this problem? If you prefer to not share publicly feel free to share via email (support[at]poweredcache[dot]com)

Thread Starter
Stefano

(@stefacchio)

I think the problem is caused by deferring, https://share.cleanshot.com/f3xHF7D0

Disable defer for wp-api resources and try again. (probably your site makes the requests for relative path /wp/….` when the base url is not set before making ajax calls.

Thread Starter
Stefano

(@stefacchio)

I developed the block, in the code I use a relative path as per the wordpress documentation.
I wanted to benefit as much as possible by using the defer on each script… are there alternatives I can implement to not disable the defer?
To disable the defer only on bees what should I enter in the defer field?

If Powered Cache is adding defer, you can enter wp-api(.*) in the exclusions. This allows you to disable defer for specific resources, so you can still benefit from it on others. Generally, deferring inline scripts can cause issues, so I suggest double-checking to avoid breaking any functionality on your site.

Thread Starter
Stefano

(@stefacchio)

Ok perfect. Thank you so much.
I noticed another problem with plugin.

After disable it, When I reactive the plugin the notification appears activated, but actually remains deactivated. In order to reactivate it, I have to deactivate and reactivate another plugin, after which powered cache is also activated

You’re welcome, and if you’re happy with the plugin, I’d greatly appreciate it if you could leave a review.

After disable it, When I reactive the plugin the notification appears activated, but actually remains deactivated. In order to reactivate it, I have to deactivate and reactivate another plugin, after which powered cache is also activated

I’m not totally sure if I’ve got this right 🙂. But object caching is often the usual suspect here — if it’s enabled, try purging it to clear out any stale data.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer