Articles of wp api

WP-API: get posts in multiple categories

Let’s say, I have two categories, ‘color‘ and ‘temperature‘. Each one has a number of sub-categories. WordPress does great job displaying posts in requested categories when I go to URL like this one: http://www.example.com/category/pink+warm Now I would like to do the same with json-rest-api plugin, via REST requests. Is it possible? How to get posts […]

oAuth2 Authentication in WordPress using WP OAuth Server and WP API plugins

I am sturggling with how authentication works in my scenario. I have WordPress site which provides set of custom APIs secured behind oAuth2 Authentication using Wp OAuth Server plugin. I started with building simple custom endpoint by extending WP REST API (WP API) plugin. I setup up my endpoint as POST /api/v1/projects, where my callback […]

WP-API and Basic Auth returning 403 on POST but not GET

I am using the latest, WP-API and the recommended Basic Auth, to test adding a post to WP from remote. I have Access Headers opened up on the WP side: header(“Access-Control-Allow-Origin: *”); header(“Access-Control-Allow-Methods: GET, POST, PUT, DELETE”); header(“Access-Control-Allow-Headers: Authorization, Content-Type”); When I submit a Get request to: http://sandbox.ravennainteractive.com/wp-json/wp/v2/posts the call easily authenticates and returns the […]

What WP-API authentication method should I use to interact with anonymous / not-logged visitors?

I am going to track number of plays of a video in my site by both visitors and users. Whenever the video starts playing I am using JavaScript for the event handling in the frontend and write to wp_options or wp_usermeta to track these interactions. I was going to make an AJAX request to the […]

WP REST API – get custom taxonomies based on terms & filter

I need to get the list of data’s with taxonomy term property_category,based on this property_category having data’s like apartment,house,office etc.For example localhost url given http://192.168.0.101:8383/wp-json/wp/v2/taxonomies/property_category And also need to get the list of data’s with taxonomy term property_type_category,based on this property_type_category having data’s like rent,sale. http://192.168.0.101:8383/wp-json/wp/v2/taxonomies/property_type_category And also one more question while filtering the data’s […]

What request is WordPress sending on theme update?

I am working on standalone theme update script and need to find out what request ( if any ) is wordpress sending when you click on update theme? example info that WP “sees” for an update is this array ( [new_version] => ‘1.0.5’ [url] => ‘http://someurl’ [package] => ‘directlinktoupdatefile.zip’ ) than you check the theme […]

ng-repeat is not returning a list of posts

I am currently trying my hand at creating a WP theme using angular JS. I am trying to work through this tutorial: https://1fix.io/blog/2014/11/05/angularjs-json-api-wp-theme/ However, I am near the end of this, and my ng-repeat is not returning a list of my posts. This is my scripts.js: angular.module(‘app’, [‘ngRoute’]) .config(function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); $routeProvider .when(‘/’, { […]

WP REST API and Access-Control-Allow-Origin

In one of my project I use a WordPress REST Api. When I was enabled cache by WP Super Cache plugin I have an error now: XMLHttpRequest cannot load http://api.mydomain.com/wp-json/wp/v1/posts. Origin http://mydomaintwo.com is not allowed by Access-Control-Allow-Origin. How can I fix it?

Get the Category Name instead of ID from WP-API

I’m trying to get the category name instead of the ID from the WP REST API for my Custom Post Type. Some articles about endpoint modification gave me some ideas on how to solve it, but unfortunately i’m not getting it to work. This is my Code (* removed irrelevant code at some lines): CUSTOM […]

WP REST API. Configuring JSON routes

I am working through the documentation on wp-api.org/ and trying to get my head around this awesome plugin, but I have a question that I can’t find the answer to anywhere, so thought I’d ask…it’s probably quite simple, but hey ho.. Whilst exploring the json data my install is spitting out (by going to localhost/wordpress/wp-json/), […]