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
13 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
17 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
11 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 ...
-1
votes
0answers
9 views

WP-API_Angular client Ang

Creating a comment for a post in to wordpress gives Unauthorised error 401 It works fine from postman It does not work for Rest API or WP-api-angular. Jwt authentication is used in WP My .htaccess ...
0
votes
0answers
10 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
20 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
27 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
195 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
17 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
94 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
36 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
105 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
241 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
59 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
71 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
21 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
130 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
14 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
47 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
47 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
36 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
547 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
70 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
75 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
1k 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
507 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
80 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
78 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
57 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
1k 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
165 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
482 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
62 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
517 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
434 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
488 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
43 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 ...
-1
votes
0answers
794 views

WordPress 4.9.1 and ifttt.com connection

Good day! I'm trying to connect a WordPress blog to ifttt.com, but for some reason it always gives me the same error: "Blog URL is not a valid Wordpress url". I've tried to find a solution, but no ...
2
votes
0answers
150 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
727 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
133 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 ...
2
votes
1answer
2k views

Create post with REST API in php with file_get_contents

Actually I have no problems getting posts. I need to create posts with the REST API in php with file_get_contents. This is my code: json_decode( file_get_contents( "http://my-site.com/wp-...
1
vote
1answer
220 views

WP-API user email change confirmation

I am developing an android client for wordpress website using wp-api and jwt plugin. By default, wordpress did not send an email confirmation when the user changes his email from control panel. I was ...
1
vote
1answer
7k views

Get more than 10 posts in a specific category with the wordpress api

I'm currently building an Ionic app that uses the Wordpress api. I can retrieve posts in a specific category by using the following: // Retrieve filtered data for the categories to show posts. ...
2
votes
1answer
132 views

How do I retrieve a list of popular plugins using the WordPress.org Plugin API?

I'd like to retrieve a list of popular plugins from WordPress.org using their API. I know I can do something like this to get a specific plugin: http://api.wordpress.org/plugins/info/1.0/...
0
votes
2answers
407 views

How to edit feature image with XML RPC?

I can't find any information anywhere about what data I need to give exactly. When I try to read the data from one of my posts with a thumbnail already I get this but there's not way you have to enter ...