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

How to Use JSON With AJAX?

Usually, you can use the global variable ajaxurl instead of any path using admin-ajax.php. More importantly, the PHP function should echo the response before calling wp_die(). Because you haven’t called wp_die(), AJAX is probably waiting for more from PHP. Hope this helps. P.S. What is that ‘json’ string doing where the AJAX fail() function should … 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

Full-Ajax Theme: parseJSON error while building a JSON object from a WordPress custom template

Replacing all the specific the_content() functions, or the_ID… etc by the getters equivalent seems to fix the problem. Here the solution: <?php $o = array(); $o[ ‘title’ ] = wp_title( ‘|’, false, ‘right’ ); $o[ ‘type’ ] = ‘single-project’; //ob_start(); $article=”<div id=”container” class=”content-area project-content”>”; $article .= ‘<main id=”main” class=”site-main” role=”main”>’; while (have_posts()) : the_post(); $article … Read more