Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions about the core RESTful HTTP API for accessing WP content and data.

0
votes
1answer
13 views

Rest API Multisite Site List?

I have a multisite and I’m able to use the rest api for posts/tags/etc for specific sites but I was wondering if there’s a away to get a list of sites on the network using the rest api? something ...
0
votes
1answer
24 views

Rest API encoding of double quotes

I have a standard rest API setup in WP. The results are displayed in an IOS App. Now the problem occurres, that single and double quotes and & are returned in the JSON as Unicode Decimal Code: eg. ...
0
votes
0answers
18 views

Rest API XML Output?

Is there a way to get the the exact same information from rest api endpoints in XML? Example: https://demo.wp-api.org/wp-json/wp/v2/posts I’m not looking for an RSS of latest posts, I want to ...
1
vote
1answer
32 views

WordPress Rest API Create Post

Is it possible to login to my different WP website from another WP website (they have different domain and host) ? Actually, I am trying to create a post on one of my site from my another site using ...
-1
votes
1answer
15 views

How to login via wordpress api and get user details?

I want to login via wordpresss api. I tried with "/wp-json/wp/v2/users" . but it just returns user 1 details. My goal is login via api and fetch all profile information.
0
votes
0answers
21 views

JQuery - Uploading image using Wp Rest API

I am trying upload an image to the wordpress media library with jquery from localhost. Here is my code function get_image_id(filename) { var img = new Image(); img.src = filename; //...
-1
votes
0answers
32 views

different between $this->meta($id, 'meta') and get_post_meta($id, 'meta')

i need custom rest api endpoint that callback a function in my function get_post_meta($id,'meta') its work but $this->meta($id,'meta') not work, why ? my function : add_action( 'rest_api_init', ...
0
votes
0answers
19 views

checking liked user in wordpress rest api

i want check liked user in wordpress rest api. liked user store in custom meta field "cd_liked_disliked_users" and when return it : i use below code for checking liked user but its not work , whats ...
0
votes
0answers
19 views

What is the way to share data between sites in a multisite

We want to display the same data on multiple sites in a multisite. This data needs to be added/edited by the client. We can create a custom post type and use the switch_to_blog function to get the ...
0
votes
1answer
19 views

Rest API basic auth not working

I've setup a basic auth for quick testing a site. $headers = array ( 'Authorization' => 'Basic ' . base64_encode( 'admin' . ':' . 'Str0nGP@$$w0rd' ), ); $url = rest_url( 'wp/v2/posts/1' ); $...
0
votes
0answers
10 views

How to delete meta-field which is registered with register_meta to Rest API

I'm working on a Wordpress integration and updating our WP JSON api v1 to v2. We have custom post types which use two custom meta-fields. One of them should be preserved to the WP's database while ...
0
votes
0answers
13 views

Get srcset and size atribute from Rest API

Is there a way to get the srcset and sizes atribute for a feature image from the posts endpoint in the WP REST API? Or do I need to generate them with JS from _embedded['wp:featuredmedia'][0]....
-1
votes
0answers
13 views

How to access WordPress custom post data in mobile appliacatins

I'm working with a mobile application using flutter. my question is how to pull WP custom post type data in the flutter. I want to pull custom post type slider into the flutter. Below is my code I ...
0
votes
0answers
15 views

How to compare date and string inside a serialized array fro REST API v2? [duplicate]

I have saved a meta data for a single post called "event" as an array like below (serialized for sure) and I would like to filter for "place" and also "date" which will be after or before some sort of ...
-1
votes
0answers
6 views

Woocommerce Filter Product using color and Category?

I am trying to integrate the woocommerce rest APIs with my Applications. All the defaults operations like get all products, get products by category etc are working perfectly fine. but how i apply ...
1
vote
0answers
13 views

With 'wp_get_nav_menu_items' identifying child menu items

I'm trying to make a custom endpoint for my menus. Using the following, I'm seeing all the menu items, but there's no way for me to see which menu items are sub menus. Any insight on this? function ...
0
votes
0answers
19 views

REST-API setup for 2 WordPress sites

I have two WordPress Websites: (1) Is a login-only "backend" site where contractors can login an enter data about their company. (2) Is a front-end site where visitors can fill out a form and ...
0
votes
0answers
42 views

JWT Authentication for WP REST API not allow other users to create posts

I have a custom post type "issues" and also custom role "clients". If my role is admin the i can create my_custom posts but when i change my user role from admin to client it don't allow me to create ...
1
vote
0answers
18 views

Wordpress + REST API v2 and private pages Load by slug

Im creating WP theme based on VUE, anyway I load pages based on slug - no by ID. I use base X-WP-Nonce header authentication, it working well with revision etc. So now I have a private page and my ...
0
votes
1answer
36 views

Woocommerce REST API not considering discounts and coupons

I am trying to create an order on my WooCommerce store from my mobile application using the REST API v2. The order is created successfully but I can't find any solution to the following issues. I ...
1
vote
0answers
34 views

Select posts by name and category per REST API

I have a site with a form, the form has 3 inputs. One takes a number, another a date, and another a select option. I made posts with categories from this select. How could I search on click of the ...
1
vote
1answer
45 views

Custom Post Type and API REST is not working

I have created a custom post type called 'customers'. I'm registering step by step as the documentation says. But when I make a call to the rest api, it just returns a 404 response. See the code below:...
0
votes
0answers
29 views

REST API: Display Category names in JSON?

Using the Wordpress REST API, I retrieve all my posts into a Angular 6 service. The category field in the JSON displays the ID of the category as an array of numbers. "category": [ 6 ], Is there a ...
-1
votes
0answers
14 views

Get pages and display in my ionic application

As a beginner i thought this would be a great place to ask the question.My question is i am able to get "pages" from my wordpress site through the HTTP get() calls but i am not able to display in my ...
0
votes
0answers
17 views

Wordpress REST API not displaying [duplicate]

I am trying to setup a headless Wordpress backend using wordpress version 4.9.7 However trying to test the GET request results in an error 404. This happens only in the above version, tested it on ...
0
votes
1answer
20 views

Update meta_value in wp_postmeta using API

I am trying to update a specific meta_key field using an API. meta_key name is _yoast_seo_redirect. it contains a redirect URL which we give in post options within wordpress. What I am trying to ...
0
votes
0answers
22 views

view counter update in WordPress REST api HTTP get

I use WordPress rest API for app communication with my site in need update post view counter when HTTP get API. I search a lot but nothing found about it, in a tutorial "Find popular posts with the ...
1
vote
1answer
55 views

Can we assume that /wp-json/ will always be /wp-json/ under any circumstances when creating custom REST routes?

For more context: WP REST API Is it rather easy to rename the default wp-json uri part? It seems that it's rather easy to change wp-json to anything. I'm passing this link to my custom route to the ...
-1
votes
0answers
10 views

how to get all registered custom fields in json response wordpress

the following is registered but how can i get it in json response $listingpro_settings = Array( Array( 'name' => esc_html__('Business Tagline Text', 'listingpro-plugin'), 'id' =...
6
votes
1answer
92 views

Does WP REST API have a built in route for calling menu?

Upon my research the latest question I was able to reference referred to the WP REST API plugin before it was built into core. The best answer on the question referred to building a custom endpoint (...
0
votes
0answers
49 views

Why does permission_callback not ovverride authentication?

I created a custome REST API endpoint for my WP instance, and upon reading the docs, they say that if you return true for the permission_callback function, that this will bypass the authentication ...
4
votes
2answers
90 views

Why is per_page not working with categories in WP API?

To start I've been searching through several questions and documentation pieces but it seems with WordPress' v2 many of the old questions are no longer valid. What I am trying to do is get all posts ...
0
votes
0answers
17 views

Is it possible to combine two rest endpoints in the url?

I have created this endpoint https://jokerleb.com/wp-json/wp/v2/ads/ and the images of any ad are located in https://jokerleb.com/wp-json/wp/v2/media?parent=24408 // ads id=24408 Is it possible ...
1
vote
1answer
57 views

How to update custom meta fields with rest api?

I get the custom meta field with rest api but not able to create or update. I'm not a programmer, I tried different solutions found on various sites but it does not work any . I used postman, the ...
0
votes
0answers
23 views

Extending the API I created to return category names

I created this api using a plugin called WP REST API Controller. But it didn't return custom taxonomy categories so I installed a plugin called WP REST API – Pure Taxonomies, it's returning category ...
0
votes
2answers
46 views

woocommerce product custom field

I have added custom field in woocommerce Products>General Tab. But I am not getting those custom fields value in response using following link:- http://yoursite.com/wp-json/wc/v2/products/ My Code:- ...
1
vote
0answers
17 views

Rest API and Custom Fields

how can I create a new post post (custom type, with custom fields) on the front end using rest api and an http request? Is this even currently possible to create a new post with custom fields through ...
0
votes
1answer
44 views

Developing Themes with React/Angular

I am learning WordPress REST API and ReactJs.I think ReactJS would be a great asset for developing faster themes and plugins.But I have a question.May be I am new to React that's why i am confused ...
0
votes
0answers
27 views

REST API Working for GET but not for POST?

I am trying to create a post through the REST API. I am able to access the API by getting the existing posts, as per the screenshot below: However, when I try to do a similar request to create a new ...
0
votes
1answer
93 views

401 Error when trying to make a REST API call to site

I am trying to make an API request from postman to WordPress. I get a 401 Authorization required error when I make the call, as per the screenshot below: The credentials I am using are from the ...
0
votes
0answers
17 views

Rest API Custom Endpoint with percent % character always returning 404

I have an endpoint like this:- function foo_hook() { register_rest_route( 'sample_namespace/v1', '/author/(?P<author_name>[a-zA-Z0-9-_\%]+)', array( 'methods' => 'GET', 'callback' => '...
0
votes
0answers
105 views

Fetching users data from REST API

As I'm able to fetch the WooCommerce REST API JSON data loaded from the CSV file and save the same data to wp_users table through WooCommerce. Installed Plugins WooCommerce Version 3.3+ . WordPress ...
1
vote
2answers
139 views

WP REST API - Multisite - get posts from all sites

Is it possible / how can I get all posts from all sites on a multisite installation using the REST API? On the front page of the primary site, I want to display recent posts from all the sites; e.g., ...
0
votes
1answer
24 views

Send data from one WP instance to another and process it there

I am looking for a good way to send data from one WordPress to another. Setup: WP1: Frontend, form to submit data. WP2: Backend, receives data and processes it. So in WP1 users just use a form to ...
1
vote
1answer
29 views

Check Password Strength using Wordpress API

I am looking to check the strength of a password using the WordPress API. I cant seem to find a function that allows me to do so. The code be <?php add_action( 'custom_api_init', function ()...
0
votes
0answers
13 views

How to make custom search look for results in fields other than title for custom post type?

I have created a custom search using JS on my website. It works fine but the only problem I have is that it doesn't look for results in any fields other than the title for custom post types. So if I ...
0
votes
1answer
164 views

Update Line Item Meta Data - WooCommerce API

stuck trying to update line item meta fields I've attached to each line item. From a call to a particular order you an see the line item meta attached below: "line_items":[ { "id":...
0
votes
1answer
24 views

use WordPress Rest API to build a web application

This is fully updated question, Angular provides two ways to build your wordpress site/application first choice is completely headless application i.e., you won't deal with wordpress dashboard at ...
0
votes
1answer
51 views

Rest API invalid nonce with Backbone Client

I'm using the built-in Backbone Client whenever I try to make a request it gives me this error: {"code":"rest_cookie_invalid_nonce","message":"Cookie nonce is invalid","data":{"status":403}} I read ...
1
vote
1answer
108 views

Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache

How to rewrite url of wordpress rest api from http://example.com/?rest_route=/wp/v2/ to http://example.com/wp-json/wp/v2/ without changing (default) permalink structure? Need this for apache (htaccess)...