Stack Exchange Network

Stack Exchange network consists of 175 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 [wp-api]

The tag has no usage guidance.

0
votes
0answers
17 views

Updata Metadata WP Rest API

I am trying to update a metadata I created from the front-end with a click event. { "id": 1248, . . . "metadata": { "wishlist_array": [ "" ], . . . ...
0
votes
1answer
25 views

Update Custom Post Type Metadata Wp Rest API

I am trying to update a custom post type metadata on the front end using JS and the WP Rest API. The object key is wishlist_array under metadata Here is how JSON response from http://ohalocal.local/...
0
votes
1answer
15 views

How to add a rest field to post tags?

I'm doing a headless wordpress, so using wordpress API. Using Yoast, I've added yoast SEO data to my post types API endpoints like this: function wp_api_encode_yoast($data, $post, $context) { $...
1
vote
0answers
8 views

Wordpress REST API “rest_authentication_errors” doesn't work external queries?

Wordpress REST API "rest_authentication_errors" doesn't work external queries? I was using following experimental codes for experimental purposes. add_filter('rest_authentication_errors', 'auth'); ...
2
votes
2answers
49 views

WordPress Rest API: How do we validate with our custom API key?

How we can verify "Cancel the header auth" the "endpoint" functions of WordPress with an API key that we produce. (Note: not a different endpoint, original endpoints) I have my own "Crypto" class/...
1
vote
1answer
32 views

How to add WP API and JS featured image attachment

I would like to fetch the image from the wordpress rest api - I have the following code: HTML: <div class="post-item"> <div id="posts">Loading posts... </div> Ajax script: <...
1
vote
0answers
26 views

No featured media in API request

when I make a request to http://localhost/wordpress/wp-json/wp/v2/posts/?_embed&categories=${categoryId}&per_page=${state.perPage} I get the following result [ ...
0
votes
0answers
18 views

Extended Custom Post type get all posts in wp-json

Using johnbillion/extended-cpts I try to figure out how can I have all posts in wp-json response. Till now what I tried did not worked I registered the post as it follows ...
0
votes
0answers
19 views

How to use the WordPress API to get links and scripts in <head> and <body>

I'm using the WordPress API as a headless CMS. I have Elementor plugin installed to do page building in the WordPress admin. I'm trying to figure out how to get all of the <link> and <script&...
0
votes
0answers
21 views

REST API pages filter by slug redirecting on certain slugs

Im encountering a super weird issue when using the REST API. When fetching a single page by slug i use the following url: wp-json/wp/v2/pages?slug=XXX where XXX is the slug of the page. Now this ...
0
votes
0answers
11 views

Display index page to user from WP custom plugin

I want to write a simple plugin to display a maintenance mode page. How I can do this? Is there a specify wordpress API to display this page on front-end?
0
votes
0answers
21 views

How to create an relation between custom posts?

I have 2 custom post types : post (default cpt) and movie. Every movie have an imdb term that is an unique string for each movie. The post (default) can contains movies inside, so I'm using metabox to ...
1
vote
0answers
31 views

Extending wp JavaScript base class to make a post request to a custom REST endpoint

I've defined a REST endpoint /my-plugin/v1/post-read to show whether a post has been read or not, per-user. In PHP, my plugin keeps track of this depending on page views while logged in. I'm now ...
0
votes
1answer
561 views

How to use Python to create a Post in Wordpress?

I found the API reference here: https://v2.wp-api.org/reference/posts/ Based on the API reference above, I wrote this Python code: from urllib.request import Request, urlopen from datetime import ...
0
votes
0answers
19 views

Create new editable route/endpoint based on meta key

I'm currently making a store which is receiving it's data from external sources. Being new to the world of editing/creating REST API, I've come across a problem. The problem is that the external ...
0
votes
1answer
213 views

Wordpress API for custom post types returns rest_no_route

I created a custom post type and I am trying to get the posts from it using WP-API, however, when I try to access the API I get the error rest_no_route message. The set up for my custom post type is ...
0
votes
1answer
46 views

wp_insert_user if user exists

I have been at this for almost two hours, i'm sure i'm close, but can't find the nudge to make it work. I built a module from scratch to import users from a csv file, the user creation is working fine,...
0
votes
0answers
164 views

Upload Media using the WP API

I'm trying to create a plugin to allow me to upload media files to the media library using the WordPress API V2. I'm trying to use Filepond to do this but I'm facing a 401 unauthorized issue. plugin....
0
votes
1answer
610 views

Add media with WP-Rest-API v2 II

I am having this exact question, asked in 2015, about adding media through the WP REST API. My code so far: curl -s -X POST http://www.example.com/wp-json/wp/v2/media/ -H "Content-Type: ...
1
vote
0answers
81 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
0answers
85 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
23 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 ...
0
votes
0answers
169 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 ...
0
votes
0answers
18 views

Create Posts from API response without duplicates

I am hoping someone can help with this. I am getting content via an API call to a third party vendor that supplies articles. I need to then add these articles as posts and also make sure I don't ...
1
vote
1answer
81 views

Can I list all installed plugins/versions and wp version from API

I would like to generate a simple text report for a Wordpress instance listing: Wordpress version Plugins installed (version and whether enabled) I can get this information from the Dashboard, but ...
0
votes
0answers
58 views

WP-API Content showing null

I am working on a decoupled theme for myself and I've worked with WP-API in the past and it was easy to get the post content. For some reason this go around I am having issues getting the content. I ...
0
votes
0answers
44 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
1answer
671 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 ...
0
votes
0answers
33 views

Add likes from Ionic app

I'm creating an app that is connected to my Wordpress backend. I use this to allow people to like the posts and I would like to enable it in my Ionic app. I've already managed to get it from the WP ...
0
votes
1answer
81 views

Why is wp api returning old acf values?

I have a list of custom post types (Events) with ACF fields for start and end dates that I'm getting using WP-API. I'm using the fetch api to make the calls. I have the acf-to-rest-api plugin ...
0
votes
0answers
141 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 ...
1
vote
1answer
2k 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":...
2
votes
0answers
611 views

WP Rest API max limit include parameter?

I'm using the rest API to get only selected posts though Rest API. I have used include=<ids> parameter. I have send the API request like: http://example.com/wp-json/wp/v2/posts?include=11,12 ...
0
votes
1answer
95 views

WooCommerce API Returns 401

very confused by how the rest api for WooComm is functioning. I understand how it should function, but it returns a 401 no matter what I do. My user is a super admin and has read/write permissions. ...
0
votes
0answers
83 views

Consume legacy rest api dependent upon WP API plugin

Is there any way to consume rest-api of WordPress plugins which were originally dependent upon the WP-API plugin in recent versions (v4.7 or later) of WordPress? In my case, I want to use the rest-...
0
votes
1answer
58 views

Hiding WordPress REST endpoints from public viewing using Basic Authentication

I have this function which register new endpoint. By default the end point is public. I'm using Application Passwords' plugin which create a basic authentication account, let's say Basic ...
4
votes
2answers
2k views

WP REST API only returning partial list of users

Started working with the WP REST API for the first time. Our ultimate goal is to dynamically load UI elements based on which user is presently logged in. However, my attempts to pull a list of all ...
0
votes
0answers
179 views

How to properly set a value to meta fields of a custom post type in WP-API/node-wpapi REST API?

I have a metafields that is assigned to a custom post which I added as a REST API field: $this->post_types = array ( 'post', 'location' ); foreach( array( 'field_1', 'field_2' ) as $field ) { ...
0
votes
1answer
512 views

rest_no_route on custom API endpoint wordpress

I've been trying to figure this out for the last day or so to no avail. I'm trying to create an endpoint to gather data from a set of tables. I'm trying to write it in OOP because I need to learn. ...
1
vote
0answers
17 views

Posting page on all subdomains

I'm just asking to see if anyone has done this or any ideas how it could be done. I have 11 Wordpress sites(on a network/multisite, 1 domain and 10 subdomains) that will grow. I'm in the process of ...
1
vote
1answer
63 views

Syntax for REST API to have bold formatted and multiple lines in product description [closed]

My description in the "Edit Product" GUI visual looks like: Description Features : Feature 1 Feature 2 I use the rest API to dump out the description and it looks like this: "description":"<p&...
0
votes
1answer
536 views

Why are <link rel> tags from the header showing up on my Wordpress site? [closed]

I am testing my new WP site. I wanted to see how it worked using a text-only browser, so I fired up "links" from my shell to visit the site. At the top of the page before my navigation menu, the ...
2
votes
2answers
5k views

How to update/insert custom field(post meta) data with wordpress REST API?

I am trying to add custom post data( post meta data) through wordpress API but I am getting difficulty while updating/adding custom post data. below is the code that am using. Code written in ...
0
votes
2answers
512 views

How can I list all installed plugins/themes/versions from CLI/API?

I would like to generate a simple text report for a Wordpress instance listing: Wordpress version plugins installed (version and whether enabled) themes and child themes installed (version and ...
1
vote
0answers
521 views

WP Rest get all by post within that category, by category name not by cat ID

I'm trying to display all posts within a specific category but by slug name not by cat id, below is what I've tried. http://centreformemories.org/blog//wp-json/wp/v2/posts?filter[taxonomy]=category&...
0
votes
1answer
2k views

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'...
0
votes
1answer
49 views

Should I edit a user meta field with PUT, PATCH, or POST and WP::Editable

I have a simple CPT called App in the backend. I have added a custom usermeta field called favorite_apps to Users On the front end, I show a list of apps, and then the user presses a star(☆) icon to ...
2
votes
0answers
156 views

How to filter users on custom meta fields in WP JSON v2?

I am trying to filter users on meta field, say abc is user meta field and value is 123 for user1. I have tried filter parameter with WP query like parameters, but it returns all users. 'search' ...
0
votes
1answer
787 views

Add Products to Woocommerce through WP API

I am trying to create a WooCommerce extension so that I can fetch products through API and store them in my WordPress store. I have been successful in storing simple products. But i'm stuck at ...
1
vote
1answer
139 views

Add Data to Response of WP-JSON Root

The default content at /wp-json/ contains name, description, url etc. but I want to add some additional content at this root level. I see lots of ways to modify the responses of items with object ...