WP-REST-API: non-namespaced route

We are using old WP-REST-API aka (JSON-REST-API)  for years and time to move on WordPress’ core REST API.

But there is a problem, new API requires namespace that we haven’t used it before. There is no problem with splitting long endpoints. I mean ,if you used ‘/foo/bar/’ as endpoint before, you can use ‘foo’ as namespace and ‘/bar’ as endpoint. But if you were using ‘/foo’ , how to migrate new REST API?

The answer is non-namespaced route.

will register ‘/foo’ endpoint.

As a reminder, please ensure before registering non-namespaced routes. They can be useful for backward compatibility only.

Advertisements

Published by Mustafa Uysal

troubleshooter at WPHandle and full-stack developer at the largest Turkish recipe website (#NYT)

Join the Conversation

2 Comments

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: