Have WordPress generate a JSON of the content

After pondering your question some I am guessing you mean to generate actual physical JSON file in filesystem to use as data source? That would certainly be unorthodox in WP development. Typically in WP you try to minimize disk access, since it is more likely to be a bottleneck in general. Doing file writes is … Read more

WordPress JSON API returns normal site page in html. How do I get it to give me JSON?

I’m likely doing it wrong, but when I form my requests for a WordPress installation at http://www.example.com/ like this: http://www.example.com/index.php?rest_route=/my/rest/route/here I end up getting proper responses back. I had a heck of a time figuring this out and ended up grokking a URL formatted like that in the HTML returned to me. I was expecting … Read more

Android authentication

The best way to authenticate an app with the REST API would be to use OAuth. There’s a good section on OAuth Authentication the REST API documentation site. You will need to install the OAuth1 plugin on your site as well. There are some gotchas with implementing the OAuth plugin on WordPress. I found this … Read more

wordpress API for android app

Yes, WP REST API supports user authentication. With this plugin you can use OAuth authentication, application passwords, or basic authentication. Read this. Here you’ll find complete documentation. For JSON API there is a plugin called JSON API Auth. Here you’ll get it. By using it you can implement authentication with JSON API. And yes, as … Read more

Create filtered list of posts using JSON data

First, you must allow your custom field be queried from the REST API. Let’s start simple with an example from 1fix.io: function my_allow_meta_query( $valid_vars ) { $valid_vars = array_merge( $valid_vars, array( ‘meta_key’, ‘meta_value’ ) ); return $valid_vars; } add_filter( ‘rest_query_vars’, ‘my_allow_meta_query’ ); So, asuming your field name is called “favorite_animal”, for this example, you can … Read more

Importing JSON feed should the content be sanitized?

There are two aspects here obviously all input should be sanitized JSON is just a wrapper no different then any other type of container which is used to aggregate data for transmission. You almost never sanitize the container as usually in case of an error you will just not be able to extract the data … Read more

How to use the new WordPress 4.4 JSON API?

The WP REST API is being developed for WordPress as a Feature Plugin. A Feature Plugin is: … the way for features to be developed for inclusion in WordPress core. This model allows a feature to be built, tested, refined, and polished before it is considered as a merge candidate source: https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/ Therefore, the WP … Read more