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 [wp-api]

The tag has no usage guidance.

1
vote
0answers
17 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
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
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 ...
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 ...
0
votes
0answers
11 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
34 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
32 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
25 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
280 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
28 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
48 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
40 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
740 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
275 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
53 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
63 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
46 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 ...
0
votes
0answers
19 views

Mail confirmation for users created via WP-API

Premise: I'm working on a project running entirely on Angular (5) for the front-end, and uses Wordpress as back-end, which will be accessed by the front-end only via REST-API. What I've done so far: ...
4
votes
2answers
756 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
129 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
354 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. ...
0
votes
0answers
31 views

With WP API how do I query posts that contains a specifc meta key?

I use the following to do "popular posts": function popular_posts($post_id) { $count_key = 'popular_posts'; $count = get_post_meta($post_id, $count_key, true); if ($count == '') { ...
1
vote
0answers
16 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
54 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
411 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
3k 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
213 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 ...
0
votes
0answers
123 views

Wordpress REST API authenticating remote request

I am trying to use WP REST API for a project and create some custom endpoints. I'v followed this documentation and created the endpoints. However I the authentication methods all refer to OAuth or ...
1
vote
0answers
400 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
0answers
89 views

WP API filter over a taxonomy

I'm using wp api v2. I registered my custom taxonomy in this way: function artist_init() { register_taxonomy( 'artists', 'post', array( 'label' => __( '...
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
30 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 ...
0
votes
0answers
613 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
125 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
583 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
115 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 ...
0
votes
0answers
163 views

store widget in object and return it in an wp rest API response

I want to use mailjet on a wordpress website in order to enable users to subscribe to a newsletter. The users should be able to insert their email address into a form, then the mailjet plugin ...
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-...
0
votes
1answer
192 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
5k 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
87 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
322 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 ...
0
votes
2answers
189 views

ng-repeat is not returning a list of posts

I am currently trying my hand at creating a WP theme using angular JS. I am trying to work through this tutorial: https://1fix.io/blog/2014/11/05/angularjs-json-api-wp-theme/ However, I am near the ...
3
votes
1answer
2k views

Custom endpoint and X-WP-TotalPages (headers)

I have a custom endpoint defined like so: add_action( 'rest_api_init', function () { register_rest_route( 'menc/v1', '/crosscat/(?P<dept>[\w-]+)/(?P<cat>[\w-]+)', array( ...
0
votes
1answer
79 views

How to get custom or filtered endpoints in WordPress API?

I am using WordPress API to show posts. How can I get custom or filtered endpoints in WordPress API? I want only the following items: Post title Post content Post Date Post categories Post featured ...
1
vote
1answer
832 views

PHP Fatal error: Cannot use object of type WP_REST_Response as array in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

I've added a custom endpoint to WordPress like so: add_action( 'rest_api_init', function () { register_rest_route( 'menc/v1', '/crosscat/(?P[\w-]+)/(?P[\w-]+)', array( 'methods' => 'GET', ...
2
votes
1answer
7k views

WP Rest API v2 filter and display latest post with specific tag

I need to display the latest post with a specific tag. Example: User tags a post 'featured', but forgets to untag earlier posts. So I want to ensure that the latest post tagged 'featured' is what ...
2
votes
1answer
2k views

WP API : date_query parameter

I'm using Wordpress API just to perform some tests. I'm currently working with the date_query parameter, which, in my case, doesn't work as expected. Just consider this request : https://wptest....
4
votes
1answer
328 views

WP API returning SQL results as strings, rather than numbers

I have this code, but what I get in the browser are all the fields - even those stored as Int and Bool in SQL - as strings. add_action( 'rest_api_init', function () { register_rest_route( 'restos/...
1
vote
0answers
665 views

Passing Meta array in wp-rest api

I have been trying to pass a meta array to a post via front-end using WP-REST API but to no avail. functions.php: //Add custom field to REST API function filter_post_json( $data, $post, $context ) { ...