

Similarly, with W3 Total Cache, if you simply use Enhanced Disk Page caching and do a head request on a cached page you will not see any Link header. The easiest method we’ve found to get the header back in this scenario is to enable the “Cache HTTP headers with page content” option: Enabling “Cache HTT headers with page content” options in caching. 💥 But when you enable caching in the default configuration it gets stripped out: With caching enabled. ✅ With caching disabled in WP Supercache the Link header is present: With caching disabled. In certain configurations, both W3 Total Cache and WP Supercache will remove them. We’ve found that many caching plugins will remove headers when serving up cached content. Issue #1: Caching Plugins Removing Headers


The trouble is, many hosts and/or managed services don’t work out of the box with basic authentication authorization header and require some adjustments to their configuration to correctly handle it. OAuth 1.0a is a pain to set up so the most common method we’ve found is Basic Authentication. The default methods used by the WooCommerce API are HTTP Basic Authentication (which can only be performed over HTTPS) and OAuth 1.0a “one-legged” authentication. To ensure that only those authorized to access said information can do so, there are a number of different methods available to authenticate users.

Not all the information available via the API is publicly accessible. There are also other methods that can be used, such as checking for a link meta element in the page source (and parsing it for the root URL similar to the header method above), but they are slightly more complicated to implement.Įven though there are a few different methods available sometimes some (or all of them) are just not available. When enabled, the REST API automatically adds a Link header to all front-end pages that looks like the following:īy sending a HEAD request to any of your sites’ front-end pages, you can then retrieve the Link header and parse it for the root URL. The handbook recommends the “link header” method as the preferred way to handle discovery. The REST API Handbook provides some good information about some of the methods and techniques you can use to do this. To help identify what the root is you can use a discovery process. This means there is no singular API root or base to contact. Unlike other REST APIs, the WordPress REST API is distributed and available individually on each site that supports it. This won’t come as a surprise but two areas that we’ve had the most trouble with are discovery and authentication. WooCommerce and the WP REST API: Where It Tends to Go Wrong Hopefully it will save you time chasing your tail searching for solutions. So in this post, I’ll round up some of the common issues we’ve faced whilst attempting to connect to a customer’s store via their API endpoints and how we’ve solved them.
#THE FOREST MOD API NOT WORKING HOW TO#
It’s a frustration that leaves many a developer scratching their head and wondering why things aren’t working.Įven after a quick google or search of Stack Exchange, it’s not often immediately apparent what the issue is or how to solve. WooCommerce has had its own API since February 2014 with the release of Version 2.1 “Peppy Penguin”, later switching to the core WordPress REST API in 2015 with release WordPress 4.4 and WooCommerce Version 2.6.īut despite almost 4 years in the wild, it’s not uncommon to run into “gotcha!” moments when attempting to make use of the REST API. If you’ve ever been stuck trying to figure out API issues when working with WooCommerce, you’ve come to the right place.
