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

For example, entering http://mywordpresswebsite.example.com/?json=1 into the browser loads the main site html, the same as omitting the json querystring variable: http://mywordpresswebsite.example.com/ The JSON API is activated. I have tried reactivating and deactivating, checking .htaccess file settings, and deactivating all other plugins. None of those have made much difference so far. 3 Answers 3 I’m likely … Read more

how to get nonce using json api

I try to open this url in my browser or calling from my frontend application: http://78.47.177.214/blog/api/get_nonce/?controller=posts&method=create_post i keep getting the response {“status”:”error”,”error”:”Include ‘controller’ and ‘method’ vars in your request.”} what is wrong, I want to be able to create a custom post type with custom fields in the end but using json api I need … Read more

Why use JSON API to display recent posts?

why not WP_query? http://www.htmlgoodies.com/beyond/javascript/provide-a-json-feed-from-your-wordpress-site-using-the-json-api-plugin.html, here if you look at the comment at the bottom the guy wants to display the recent posts using the JSON API plugin but why bother, when you can do it with WP_query? 3 Answers 3 The JSON API is just a wrapper for WP_Query bundled with RESTful endpoints (add_rewrite_rules). Its … Read more

How to Securely and remotely Create new user in wordpress using Rest API

I am trying to create users in wordpress Version 4.9.1, remotely using the wordpress API. This is my PHP code below: $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_PORT => “8080”, CURLOPT_URL => “http://localhost:8080/my_site/wp-json/wp/v2/users/”, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => “”, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => “POST”, CURLOPT_POSTFIELDS => “——WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent- Disposition: form-data; … Read more

WP REST API – Retrieve content from page

I already get posts from categories with: http://domain.com/wp-json/wp/v2/posts?filter[category_name]=category-name but how can i retrieve content from page? – [page_name]=page-name for example but its not working. I have searched lot but cant found any solution. Thanks. 4 Answers 4 To retrieve a page by slug, just use /wp-json/wp/v2/pages/?slug=your-page-name-here, with “your-page-name-here” obviously being the slug of your page.

WordPress wp-json API – Custom Post Type returns 403

I’ve been trying for a full day to get a really basic install of the WP-API to answer to a custom post type (in this case called ‘transactions’). The post type is set up and fully public, and it’s existence is acknowledged by querying example.com/wp-json/posts/types/transactions. I’m getting the expected response from example.com/wp-json/posts?type=page but a 403 … Read more

WordPress json api taxonomy index method

In edition to this post below: wordpress json custom taxonomy problem How to write a method for getting categories withing a custom taxonomy, similar to Method: get_category_index in core json api controller? Scenario: I have a taxonomy called – books which has four categories and i need those categories to be outputted through get_taxonomy_index. Something … Read more