Articles of restful

Confused on AJAX submit form through page template

I think I’ve been looking at too much code and have confused myself while trying to get a better understanding of forms in WordPress with AJAX. I set out this week to learn how to create a form for a page and submit it through AJAX. The page is a template and the action I’ve […]

WP REST API, query total posts in a category

I have just started playing with the WP REST API and found that when querying posts that there is a limit of 10 post per page unless specified. What I would like to know if is is possible to return the total number of post in a category though meta data or something similar?

Is there a hook to process a backbone restful PUT request inside wordpress?

I play around with Backbone.js (Great !) and want to synchronize my model data with the wordpress ajax api (3.6.1) on the server-side. Adapted to this, here is my backbone example: var new_posts; var post; (function($){ var Post = Backbone.Model.extend({ id: ”, title: ”, }); var Posts = Backbone.Collection.extend({ model: Post, url: APP.ajaxurl + […]

Request object for validate_callback

I’m trying to define a new REST Api endpoint based on WP REST API (version 2) and have question relating to what arguments are available to the validate_callback and sanitize_callback. Is the Request object made available for these callbacks? For example: add_action( ‘rest_api_init’, function () { register_rest_route( ‘myplugin/v1’, ‘/author/(?P<id>\d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => […]

How to remove rest api link: in http headers?

i would like to remove the “link:” line added to the http headers since wordpress 4.4 here is a curl -I here is the output extract of the line that i would like to delete: Link: <>; rel=”” Note that i don’t talk here about html headers but http headers.

Implementing the wp json-rest api

I have a client that wants to use the wp json-rest api to allow third-party sites to push custom posts (in this case property listings) up to our site. I’ve been looking at using the wp json-rest api, since people seem to be having really good success with it and it looks like it would […]

WP REST API route request explain

Maybe can someone explain or show additional info about “WP REST API route request” from beginning to the end. Main questions, how handle this request in most earlier stage. For example for ajax requests, is second check: if (defined(‘DOING_AJAX’) && DOING_AJAX) { /* it’s an AJAX call */ } What check can be most fast […]

How to call a REST endpoint when a post is published?

I need to make WordPress call a specific REST endpoint when a new post is published, passing the most important post data via JSON. I found a plugin, HookPress, that apparently did just that by letting you configure webhooks for various events. Unfortunately it has not been updated in over 2 years and does not […]

How do I use the WP REST API plugin and the OAuth Server plugin to allow for registration and login?

Are there any example projects that do the same? I want to be able to login and register for accounts on my site via the API.

How should an old API version be deprecated gracefully?

When researching and reading about the WP REST API utilization I’ve seen many topics mentioned about how another version should be rolled out but nothing in the documentation regarding a return for a deprecated version. Planning the life span of an API and how I should develop for each version I was unsure how I […]