Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

allow skip catching for wp-admin referer, or by filter

$
0
0

Replies: 0

Hi,

would like to skip the catching for all requests from wp-admin.

Currently I added some lines to Endpoint_Api::skip_caching:

if ( substr( $_SERVER['HTTP_REFERER'], 0, strlen( admin_url()  )) === admin_url() ) {	
	return true;
}

Would be nice to have a filter there, so I could write an mu-plugin and hook my custom skip function. Some filter like this:

if ( apply_filters( 'wp_rest_cache/skip_caching', false ) ) {
	return true;
}

To skip all requests from wp-admin referer solves/skips all gutenberg issues.
Adding an option to the plugin settings page would be great. Think that might help some users.

Some background: I got this issue using wpml. It always shows the cached custom taxonomies and terms in the editor inspector, that leads into weird language syncing issues.
Example: gutenberg wants to list our custom taxonomy terms for prefix_region and calls /wp-json/wp/v2/prefix_region?per_page=100&orderby=name&order=asc&_fields=id%2Cname%2Cparent&_locale=user. The request url is same for all languages.

And thanks for your plugin! its great. and the code is nice to read, lovely poetry


Viewing all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>