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

Questions tagged [rest-api]

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

0
votes
0answers
11 views

woocommerce axios react

I don't understand why my request to WooCommerce API doesn't work. My usage on react App via axios: First try: return axios.get( 'http://domain/wp-json/wc/v3/products?featured=true', { ...
0
votes
0answers
15 views

Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment

I'm looking for some advice in regards to how I approach dealing with a redirected URL with params. I have a client, let's say Client #A. They have a WordPress website we previously created with ...
0
votes
0answers
7 views

Conflict between using X-WP-Nonce and Token

Currently, I am working on WordPress project and I have a problem is that: If you are already signed in with normal way by saving cookie with X-WP-Nonce then I cannot use token to post a comment or ...
0
votes
0answers
11 views

ERR EMPTY RESPOSNE on ajax delete request in wordpress

I am trying to delete a post with REST api endpoint. evry thing is working fine on local. but on live(000webhost server) its giving error with no response text. http://mylivesite/wp-json/university/...
0
votes
0answers
16 views

Divi builder injects its shortcodes in the rest api

We use Divi themes and builder from elegantthemes.com, maybe the most popular theme ever. We are using the latest WordPress and Divi versions. The divi shortcodes appear in the rest api, as you can ...
0
votes
0answers
14 views

Custom Default Comment API of WordPress

I am working on WordPress Rest API and I realized that it is easy to make a spam comment. I want to limit an user when they leave new comment consequently in short time. I want they have to wait at ...
1
vote
0answers
16 views

Custom Post Type not showing in Rest API on Multisite

I'm using WP Multisite and can't seem to pull through my custom post types via the API. <?php function terms_post_type() { $labels = array( 'name' => _x( 'Policies', '...
0
votes
1answer
25 views

Saving custom post types post_meta over REST-API fails

I try to save with wp-json my custom post types meta data but does not works in my case I create my custom post type with jjgrainger's class as it follows $arguments = array( 'public' ...
1
vote
1answer
31 views

Request to REST endpoint works fine in browser and curl, but fails from WP_REST_Request

I'm running WordPress 4.9.8 with a Genesis theme (probably irrelevant, but...). I'd like to write some JSON pulled from the REST API directly to a script tag when a page is built (rather than hitting ...
-1
votes
0answers
10 views

In my android app using REST-API not loading latest posts [closed]

My wordpress self-hosted website is ok with everything on web but while using rest-api on my android app it doesn't show last 2-3 posts. Reloading in app not doing anything. Am i missing something on ...
-1
votes
0answers
7 views

PHP 7.2 compatibility errors on rest-api plugin [closed]

Can you please fix the error on this plugin, We are using this plugin in our website on PHP 7.2 version, We have checked the compatibility of rest api plugin with php 7.2? I’m receiving this error ...
0
votes
0answers
8 views

filter by Meta custom field in rest api defined by pods as realtion to categories

i installed PODS and create a new custom post type named locations and relate it to default Wordpress entity : category when i call mydomain.com/wp-json/wp/v2/locations?fields=id,category rest ...
0
votes
1answer
13 views

REST api header link href

If I call curl -I https://example.com In terminal I get the correct response Link: <https://example.com/wp-json/>; rel="https://api.w.org/" If I call $response = wp_remote_head( 'https://...
0
votes
1answer
19 views

Rest API in self-hosted page doesn't work [closed]

First of all, I'm a total WordPress newbie and I genuinely couldn't find an answer to my question: I have a site hosted in WordPress (https://srebelo80.wordpress.com) which I'm planning to use as a ...
0
votes
0answers
22 views

Error rest_post_invalid_page_number trying to call Rest API

I got the following error, trying to call all posts or alle posts from a specific post type via the REST API: /wp-json/wp/v2/posts /wp-json/wp/v2/posts?page=1 /wp-json/wp/v2/posts?page=1&...
0
votes
0answers
19 views

Wordpress Rest API Error 502

My Website had problems dealing with attachments (uploading seemed to result in a HTTP Error quite often) so I dug around a little. Developer Tools showed me that the /wp-admin/async-upload.php ...
0
votes
1answer
22 views

How to Get Featured Image from REST API?

I am trying to get the featured image of a post using the WordPress REST API. I am adding the extention of ?embed to the end if the REST API url and I am seeing the featured image data under ['wp:...
0
votes
0answers
26 views

How to use current_user_can() in register_rest_route()?

I'm trying to assert current_user_can() in the permission_callback method of a register_rest_route function. However, it always returns false. Upon further debugging, I see that wp_get_current_user() ...
2
votes
0answers
34 views

Edit srcset and sizes attributes in Gutenberg image, cover and gallery - blocks

I am looking for a way to adress the responsive srcset and sizes attributes on Gutenberg image blocks - like image, cover and gallery. Usually one would do this with the '...
0
votes
0answers
30 views

Getting data from JSON - ACF Plugin

Is there anyway to get data for ACF fields from JSON? I mean for example you have a new post where you have your ACF fields there, how can you fill those fields by giving the JSON url to one of the ...
0
votes
0answers
10 views

How can I best automate publishing a given number of recent draft Posts for a custom post type after every one minute?

I've looked at several ways this can be done, and the reason why its not been fruitful is because I am targeting posts added via the REST API from the APP. When posts are added via the app with a ...
4
votes
1answer
271 views

Get the list of enqueued/registered scripts for a specific post?

I am exploring how to build a theme where most of the pages are loaded using the Rest API. I can load the index page and from there make GET requests to get posts json data and after build its content ...
1
vote
0answers
21 views

post meta parameter in post custom-post-type endpoint with restapi

I'm trying to create a new custom post via the native Wordpress REST API POST /wp-json/wp/v2/CUSTOMPOST at the moment I used the wp-rest-api-controller plugin to activate the endpoints the custom ...
0
votes
1answer
50 views

WP REST API Custom endpoint don't work in my plugin

I would really appreciate help on this, as i have tried and tried. I have made this very simple endpoint to som basic info from a custom post type called 'ydelse'. Here is my class for the creation ...
0
votes
0answers
16 views

How to query the “standard” post format with the REST API?

I'm trying to write a search filter where it filters by author, category, and post format. I have successfully been able to filter by audio and video but am at a loss for the standard post format. ...
0
votes
0answers
22 views

WordPress api not working

I'm completely new to WordPress. I just set up my first site (chose a free plan). I read that there should be an API available at https://mysite28703553.wordpress.com/wp/v2/posts or https://...
0
votes
1answer
13 views

getting posts by tags

i use below code for getting posts by word tag $search_songs = array( 'posts_per_page' => -1, 'post_type' => 'songs', 'tax_query' => array ( array ( ...
-1
votes
0answers
19 views

How to get a mixed json result from 2 custom tables by using REST-API?

I have 2 custom tables in my database, named family and child. I want to display them in a json result by using rest-api, such as www.example.com/wp-json/families There are 3 columns in family table: ...
0
votes
0answers
14 views

WordPress multisite rest API

I have a question. I created a WordPress Multisite. And the Rest API for my site and subdomain does not work with this site https://cjdropshipping.com/.(I gave them the api key and authorized my store ...
0
votes
0answers
9 views

Different WP Rest API custom endpoints across different themes

I have created a custom theme on Wordpress with custom WP Rest API endpoints. This is how I have set it up. Theme name: Theme 1 Added below line in functions.php require get_parent_theme_file_path( ...
0
votes
1answer
27 views

Extending REST API responses

I have a custom post type with a parent post, and code to fetch this post in Javascript via a GET request, all is working very well. The API endpoints I'm using are those provided by core when ...
1
vote
0answers
26 views

Ability to make API calls out of Wordpress as well as executing SQL?

I'm pretty new to Wordpress, so I'm risking some downvotes here... but, I'm curious, are there any recommended plug-ins that have the ability to make REST API calls? I have access to a third party ...
0
votes
1answer
17 views

How to add / embed an author into REST data from a custom post type?

We have a couple of post types which don't directly support authors. Instead, we have custom interfaces for choosing the author. We end up with an author ID, though, so I'd like to inject that author ...
1
vote
0answers
22 views

Access Wordpress data from external PHP application.

I am a volunteer in a non-profit organization. I have taken over maintenance of a number of apps written in PHP/SQL/Dreamweaver. The apps are over 10 years old. I am migrating these apps from PHP/SQL ...
0
votes
0answers
23 views

Content personalization

We have a quite popular website with about 15k of concurrent visitors on it at peak times and lots of content for them. What we want to build is a module on our home page which will allow users to get ...
0
votes
0answers
11 views

How can I isolate a REST API's back-end function so that it only loads precisely what it needs?

I have static data (array) that never changes and I can write an SQL query to pull it out, for reference, I hold it in wp_options because it's initially inserted with update_option. This information ...
1
vote
0answers
42 views

Get all post media images via WP REST API

We want to build a back-end for a mobile app using WordPress. We are trying to get all post images, but when we call https://api.com/wp-json/wp/v2/media?parent=58 we are getting only the first image ...
0
votes
1answer
85 views

Add Category Name to REST API

I am using the URL: http://website-url.com/wp-json/wp/v2/qd_leadership to get the data for that custom post type. I then created custom taxonomies for this post type. That only displays the taxonomy ...
0
votes
1answer
16 views

Core function to check if a rest namespace exists

Does WordPress have a core function that will check if a rest namespace exists? I would like to use the following function (or something similar) in multiple plugins so it would be helpful if there ...
1
vote
1answer
69 views

Custom REST API endpoint returns rest_no_route when called via wp-json permalink

I have the following code in my plugin, which during development has been working perfectly fine (called within rest_api_init). // ?rest_route=bridge/v1/test-data/process/bbe_examples ...
0
votes
0answers
23 views

WooCommerce REST API wcapi.get('orders') 403

Set-up I connect to my WooCommerce webshop through the WooCommerce REST API Python wrapper, I.e, from woocommerce import API wcapi = API( url="https://mywebshop.whatever", consumer_key="...
0
votes
0answers
47 views

Search WP API using the post title

I'm using the WP REST API v2 to try and search for all posts with the same title, what I'm trying to do is create a sort of head-to-head/previous meetings page for 2 teams. At the moment i can ...
1
vote
0answers
77 views

WP REST API returns blank response if post is too long

I'm working on an iOS app that requires the use of WP Rest API to fetch posts. Everything is working smoothly and I fetch posts by ID using this endpoint: https://example.com/wp-json/wp/v2/posts/...
0
votes
0answers
20 views

How to add a custom post type to the “wp.api.collections”?

I'm looking to add a custom post type to the API called "Properties". I have the Custom Post Type working without a problem and it is accessible through wp-json/wp/v2/property My problem is that the ...
0
votes
0answers
16 views

Restrict REST-API to requests from a certain website (or ip adress)

So my question is rather simple. How can i restrict the access to my RestAPI to only be allowed for some domains/ips ? I'm creating a React front-end and using wordpress RestAPI as a backend. I've ...
0
votes
1answer
52 views

how to show product custom taxonomies in woocommerce rest api

I'm working with woocommerce rest API v1 to build a shop page working with AJAX. What I have tried : created custom taxonomies for woocommerce products post type set show_in_rest to true for those ...
0
votes
0answers
40 views

WP REST API - Add post with taxonomy using term_name

Hi there we have API requests hitting our WP site to import posts into a custom post type. In the JSON for the post type the taxonomy "job_sector" is sent through as a string using the terms name ...
0
votes
1answer
25 views

How to handle new post from API request?

I feel silly for even asking this, as it seems like it should be very straightforward but I'm having a hard time finding this information. Goal: Make a POST request to the WordPress API with new post ...
1
vote
2answers
93 views

WordPress REST API - Modify JSON before importing

Hi guys so I have some data hitting my WP from an external company at /wp-json/wp/v2/jobs/ to be imported as a post. This data contains JSON that needs to be imported, however it tried to set ...
0
votes
0answers
45 views

Custom endpoint without loading entire Wordpress

With only WooCommerce installed the Wordpress rest api loading time is above 1.5s, this is unpractical, so i'm trying to create a custom endpoint and define SHORTINIT to true to load the minimum ...