Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST_REQUEST is defined after plugins_loaded. #11

Open
peterwilsoncc opened this issue Jun 28, 2019 · 0 comments
Open

REST_REQUEST is defined after plugins_loaded. #11

peterwilsoncc opened this issue Jun 28, 2019 · 0 comments

Comments

@peterwilsoncc
Copy link

peterwilsoncc commented Jun 28, 2019

The plugin runs the following on the plugins_loaded hook to determine if the site is making a rest request.

// Don't redirect REST API requests
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
	return;
}

Unfortunately, REST_REQUEST is only defined after the plugins have loaded so after the code above is passed.

Moving the redirect to the send_headers action works around this.

r-a-y added a commit to r-a-y/Mercator that referenced this issue Oct 20, 2020
Fixes an issue with checking for REST API requests since
'plugins_loaded' runs before the REST API is loaded.

See humanmade/Mercator-Redirect#11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant