Questions tagged [wp-api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
3 answers
2k views

WP API: Get posts excluding those with a tag or category name

I know from this post that I can get posts by tag name by just specifying a filter[tag] query parameter. And similarly with filter[category_name]. Is there a way to get posts that are not in a list ...
The Unknown Dev's user avatar
2 votes
4 answers
7k views

WP API to fetch all the media/posts records if count is more than 100

I am using per_page instead of the filter since it is no more available. but the problem is per_page value can be between 1 and 100. what if I want to pull records and it is more that 100. per_page ...
Srikant Behra's user avatar
3 votes
1 answer
1k views

WP API to fetch all records for /posts, /media, /categories

I was using the below API to fetch all posts http://example.com/wp-json/wp/v2/posts/?filter[posts_per_page]=-1 Since the last two days, all of a sudden it stopped working. For example, the first ...
Srikant Behra's user avatar
0 votes
1 answer
53 views

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 ...
Benn's user avatar
  • 1,043
0 votes
1 answer
528 views

WP API users per page

I've been testing around the v2 of the Wordpress plugin WP REST API in a web app. My goal is to develop an Ionic app. I've found a problem, though. I've managed to list 100 posts of a custom post ...
Gecko Room's user avatar
0 votes
1 answer
227 views

Fetch only categorized posts

I'm using v2 of WP-API to fetch posts and would like to exclude posts in the Uncategorized category. None of the following works: /wp-json/wp/v2/posts?filter[cat__not_in=1] /wp-json/wp/v2/posts?...
Nathan Baulch's user avatar
8 votes
3 answers
14k views

WP-API v2 Custom Endpoint Response Formatting

I'm trying to use a custom endpoint (basically to get a random sorting working) and am using the following code: // Custom WP API endpoint function theme_enable_random_api() { // create json-api ...
evu's user avatar
  • 319
1 vote
1 answer
3k views

Get all tags not just first 10 with wp api 2.0

if I do /wp-json/wp/v2/tags I only can get first 10, and seems the adding per_page=0 no longer work on it for getting actually all tags. Anyone knows how to actually get all the tags with wp-api 2.0?
Ezeewei's user avatar
  • 185
9 votes
1 answer
5k views

Uploading media with the REST API

I am having trouble when uploading media to a WordPress site with the JSON REST API. With the following code I can upload the photos, but no info is assigned to them, not even the name - in fact the ...
Diario de Morelia's user avatar
24 votes
5 answers
34k views

Hiding WordPress REST API v2 endpoints from public viewing

I would like to start using the WordPress REST API v2 to query information from my site. I've noticed that when I visit an endpoint URL directly, I can see all of the data publicly. I've also seen ...
Morgan's user avatar
  • 489
1 vote
2 answers
4k views

Mass importing json data into custom fields (postmeta)

I am in the process of importing large amounts of data into a custom post type that has several custom fields (postmeta fields created by Advanced Custom Fields). I am using the following function to ...
mantis's user avatar
  • 780
0 votes
1 answer
4k views

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....
sankar muniyappa's user avatar
3 votes
1 answer
4k views

How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API

I'm new to wordpress and also working with WP REST API for mobile application development for the wordpress website. Here I want get data's filter & search based post meta custom fields. I've ...
sankar muniyappa's user avatar
1 vote
2 answers
2k views

How to quickly reorder posts in the admin panel that will persist for the wp-api

I generally use the Intuitive Custom Post Order plugin for any WordPress sites I work with so clients can order their posts visually. For this project, I'm using WordPress as an admin panel and ...
sheriffderek's user avatar
3 votes
4 answers
30k views

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 ...
Leo's user avatar
  • 31
0 votes
0 answers
29 views

How to retreive/set wordpress page html?

Please bare with me , I come from joomla world and we have a method getBody() https://docs.joomla.org/API17:JResponse::getBody and setBody(); https://docs.joomla.org/API17:JResponse::setBody ...
Benn's user avatar
  • 1,043
0 votes
1 answer
3k views

Authentication for a mobile app connected via wp-rest api?

Building a cordova (HTML/JS) based mobile app (not-native) and I want to use wordpress only as the backend. The idea is that mobile app users will be making requests to the API and custom endpoints ...
gyaani_guy's user avatar
1 vote
1 answer
467 views

WP-API select custom taxonomy when creating a post

I am using POSTMAN to test out some API Routes using WP-API. I have created a custom post type called timeslot and have associated a custom taxonomy called location to that post type. When I am ...
TGuimond's user avatar
  • 155
1 vote
2 answers
15k views

Authenticating a user with the WP-API V2 in Postman

I'm using Postman to test my project and the wp-api. More specifically POST requests where a user must be authenticated to do something. Here's what I'm working with to create a user: {{url}}/...
Ben Racicot's user avatar
  • 1,406
5 votes
1 answer
3k views

wp rest api v2 return json_no_route

i am using WP rest API v1 and everything is ok. But now i want taste some WP rest API v2. the problem is, when i cal: mysite.com/wp-json/wp/v2/posts or: mysite.com/wp-json/wp/v2/post or ...
mil's user avatar
  • 353
0 votes
1 answer
336 views

Best Way to detect unique posts in wp rest api

I am developing an android app for my WordPress blog. I have some bad trouble to detect and get post. So first I give u a vision from what I am into: I want to get post from past, so I do this: Get ...
mil's user avatar
  • 353
1 vote
1 answer
785 views

Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?

I'm developing a simple Ajax function as part of a plugin intended to be used from within the traditional WP Admin dashboard but am encountering a discrepancy regarding the login cookie state. The ...
M12's user avatar
  • 226
0 votes
1 answer
713 views

WP-API + JS Backbone client - how to update post meta

Using the WP API and Backbone-based JS client, I'm trying to update a post's metadata as follows: var parentId = 96; // the post id var metaData = new wp.api.collections.PostMeta('', {parent: ...
pdme's user avatar
  • 292
15 votes
4 answers
35k views

Get post count in wp rest API v2 and get all categories

I want to get the count of my posts. I think use wp-json/wp/v2/categories?page=1 >> count it's a good way to go. But using above solution is not a cup of tea in term of speed and i don't know how to ...
mil's user avatar
  • 353
3 votes
1 answer
3k views

WP REST API V2 - Modifying responses

I am trying to modify the response object of a WP REST API (v2) call following this guide: http://v2.wp-api.org/extending/modifying/ I have a post type called Careers and a taxonomy called Regions. ...
user1385827's user avatar
5 votes
0 answers
2k views

Insert variations via woocommerce api [closed]

I want to add variable product via woo commerce API. I successfully added the normal product via node js and php but need some example how to add variable product. I searched in documentation https://...
DHRUV GUPTA's user avatar
0 votes
1 answer
660 views

Combining results from WP-API using AngularJS

I currently have this site - http://dev.5874.co.uk/scd-data/ where I have a dropdown which displays results from WP-API which I am pulling in through AngularJS. It currently combines the two sets of ...
Lucy Brown's user avatar
1 vote
0 answers
93 views

Using Wordpress as an API [closed]

I'm considering using the new WP API to power a mobile app. I also want to have a web frontend with a restricted membership area, BuddyPress as well as bbPress installed. I'm wondering though if ...
Giles Butler's user avatar
5 votes
1 answer
1k views

Wordpress Rest API

I'm trying to call a post from a Wordpress install using WP REST API. I keep getting an error in return and I can't find out why. Do I need to authenticate? One website said I don't need to ...
The Hawk's user avatar
  • 169
0 votes
1 answer
797 views

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 ...
Jan Beck's user avatar
  • 1,467
1 vote
1 answer
160 views

Faceted search with WP-API data

I have this site - where I have a post type called listings with a number of custom taxonomies and terms. - http://scd.blaze.wpengine.com/ If you choose a region it then shows you listings that are ...
Lucy Brown's user avatar
0 votes
0 answers
352 views

XMLRPC: How to retrieve possible custom fields for a new post?

I'm planning to implement certain XMLRPC elements in my external web application. If I'm passing wp.newPost as the method, how can I get the possible custom_fields? I don't have access to the ...
zerohedge's user avatar
  • 101
1 vote
1 answer
720 views

WP REST API - reading custom post type

I have a WP site that runs on WP version 4.3 and using a plugin WP REST API version2-beta9. I have a custom post type animals which has an ACF select field of class which has values like mammals, ...
Carl Alberto's user avatar
  • 1,067
1 vote
0 answers
603 views

WP - API - OAuth 1.0a Server, How to implement with AngularJS?

I making an Angular WordPress theme and I want to add authentication to it using the WP REST API - OAuth 1.0a Server plugin, which isn't documented not very well. I get oauth_token and ...
bobsilon's user avatar
  • 111
10 votes
2 answers
9k views

Query WP REST API v2 by multiple meta keys

Using v2 of the REST API, I'm wanting to query some posts by multiple meta keys. With v1 I was able to format the url like &filter[meta_value][month]=12&[meta_value][year]=2015 and it worked (...
Trevan Hetzel's user avatar
4 votes
1 answer
6k views

How to loop through JSON data in wordpress WP REST API

I am using the WP REST API plugin in wordpress and want to loop through my json data using a for each loop, however when I var_dump the variable that the json data is stored in it gives me an error. "...
Raj Chudasama's user avatar
0 votes
1 answer
418 views

return content section as json in wp rest api v1

I am using WP REST API. I want to get the posts from my blog and show them in my android app. So, everything is OK, but i need to ask a question to make sure about something: when i call posts in the ...
mil's user avatar
  • 353
0 votes
1 answer
2k views

Remove a field from json in wp rest api v1

I want to create an android app for a WordPress blog using WordPress rest api. For optimization I want to remove content field and some other fields when I get all post to show them in my main list ...
mil's user avatar
  • 353
24 votes
8 answers
46k views

Get WP Navigation Menu from REST API V2

I'm trying to get the navigation menu from JSON response using WP REST API v2 plugin. There is no navigation menu plugin extension for the REST API v2, but only for V1. From codex WordPress Post ...
Murhaf Sousli's user avatar
17 votes
3 answers
33k views

How do I access the body of a WP API request in a custom route?

I have created a custom route in WP API (v2 beta 4) to set a site option. I'm using AngularJS to make the API call, and for some reason, I'm not able to access the data sent within the request. Here ...
Ryan Hale's user avatar
  • 171
0 votes
1 answer
743 views

WP API and Proxy

I'm looking to implement a WordPress API service using the WP REST API plugin. However, I do not want the frontend to access the API directly so I'm opting to implementing an API Proxy. Can the WP ...
Kendall's user avatar
  • 189
2 votes
1 answer
14k views

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: *"); ...
TJ Sherrill's user avatar
0 votes
1 answer
2k views

WP REST API v2. filters doesn't work

I'm using WP REST API v2 to get posts. When I tried to open localhost/wp-json/wp/v2/posts in my browser I got json with all my posts. I tried to open localhost/wp-json/wp/v2/posts/?category_name=...
Sergei Rodionov's user avatar
0 votes
1 answer
1k views

WP REST API Access-Control-Allow-Origin response is cached

I have an AngularJS site that is pulling in posts from WordPress via the plugin "WP REST API (WP API)". I am testing a site on both dev and staging subdomains, and the WP API works on both. However, ...
Hugh Guiney's user avatar
3 votes
2 answers
6k views

Unset data in custom post type WordPress API (wp-json)

I can already unset (remove specifics from normal posts) in the json returned from the WordPress API. I actually use the following below from this example: https://css-tricks.com/using-the-wp-api-to-...
RMH's user avatar
  • 183
4 votes
2 answers
6k views

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.
Louis93's user avatar
  • 141
0 votes
1 answer
962 views

Best way to retrieve data in custom api extended from wp-api

I have extended WP API plugin to provide an API which can process documents. Routes public function register_routes($routes) { $documents_routes = array( '/v1/documents' => array( ...
Ghazanfar Mir's user avatar
0 votes
1 answer
4k views

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: ...
brownian's user avatar
  • 236
2 votes
1 answer
494 views

get_post_type_object() does not work with switch_to_blog()

the title is pretty much self-explanatory but it seems that get_post_type_object() does not work with switch_to_blog() here is the situation I have blog A and blog B. I registered a custom post type ...
wordwannabe's user avatar
0 votes
2 answers
6k views

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 ...
Ghazanfar Mir's user avatar