WordPress and JSON. Who the heck is JSON?

If you go to your WordPress Site and add /wp-json to the end of the URL, you will most likely see an entire page of characters display in the browser. This feature is called Rest API and we will demystify some of the content of the /wp-json page for you here.

The content of this page is a json string, an industry standard for storing information in an organized way. Json makes it easy for other programs to access and process the data. You can see the content of the json better if you use the Firefox browser or Postman.

On the top of the page you see some basic information about your site, followed by “namespaces” and “routes”. Namespaces are different methods or services provided by your WordPress Rest API. Routes are different URLs you can visit to drill down on the information regarding your site.

Let’s look at a couple of specific URLs. If you add /wp-json/wp/v2/types to your site’s URL you see the different types of information from your site available in json format. One of the options is /wp-json/wp/v2/posts which shows information about the content of all the posts on your site.

What is the purpose of wp-json?

Other website or applications can connect to your site using the Rest API interface. Some of the content requires the Rest API user to log in, other is available to anyone.

The content can also be used by search engines and web crawlers to index your pages, posts and products.

What should I do about it?

In most cases you can leave your Rest API as is. In some cases you might see information posted in the json format that you did not want to have displayed to the public and available for web crawlers. Many plugins post information from your site to wp-json without your knowledge so it’s good to check and see what is there.

Have you found some information in the wp-json that you would like to block? Do you have an application you would like to connect to your website via API? Send us a note and we will assist you with any WordPress API needs.

Leave a Comment

Work With Us

We've been building websites for over twenty years, and have learned a thing or two about how to make web projects go smoothly.

CLOSE