Newest 'wordpress-rest-api' Questions - Stack Overflow

Questions tagged [wordpress-rest-api]

The WordPress REST API

1
vote
1answer
17 views

Change the returned WP Rest API JSON response Format

Is there a way to change the returned wp rest api json format? Instead of an array i'd like the response to be in an object format. Desired format: { "articles": [ { "id": ...
-1
votes
0answers
20 views

How to use a Rest API to connect WooCommerce to a supplier's data warehouse? [on hold]

I am creating an e-commerce store with WordPress/WooCommerce. My client wants all products to be shown via a REST API. I got a PDF document from his supplier company that shows how to make API calls ...
1
vote
0answers
23 views

Wordpress REST API - Image not showing up

I want to display a IMG through the Wordpress REST API. I got the image url successfully, however it won't display. I assumed it was due to CORS headers, but that does not seem to be the case. I got ...
-1
votes
0answers
15 views

WordPress, resized image download using URL only

I need to download the resized image directly from WordPress using its URL only, something like : https://wordpresssite.com/wp-content/uploads/2019/06/imagefilename.jpg?w=300&h=300&&crop=1 ...
0
votes
1answer
27 views

Handlebars.js: {{ this.url }} not working within <img src=“{{ this.url }}”>

Handlebars.js won't parse the code if i place it within a / etc. As soon as it is outside, it works fine. <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"...
1
vote
0answers
11 views

TypeError: Cannot read property 'data' of undefined Gatsby Wordpress Netlify

I'm trying to deploy my gatsby site connected to a wordpress database. But it doesn't work. The error says that it can't recover the data yet I put the configs in gatsby.config 3:58:01 PM: 3:58:01 PM:...
0
votes
0answers
17 views

C# post using xcsrf token using HttpWebRequest

C# post using xcsrf token --- I'm trying to call the "Create" method of POST API call but for that I have to pass the CSRFToken (geting value of csrfToken from result of login api) I'm using ...
0
votes
0answers
21 views

I can import one product with the Woocommerce Rest API but I am having trouble figuring out how to import the whole array of products

The code will import one product when I set the variable to a single item in the array as expected. When I take off $product_name[0] and change it to $product_name in order to import the whole array ...
0
votes
1answer
20 views

How do i grab all users with their meta data?

I am building out a website that has about 7500 users. What i wanted was to grab all of my users and their meta data and return it to me through a rest api call that I built myself. Currently I am ...
0
votes
1answer
17 views

Email notification whenever a comment is created via WP REST API

I'm building a custom comment form for my Vue.js & WordPress Single Page Application theme and was able to post a comment via ajax POST request to the WP REST API. But I don't get any admin ...
0
votes
1answer
15 views

Need to forward Data from WooCommerce Webhook sent to same site Wordpress REST API custom endpoint

I created a Wordpress REST API custom endpoint to be used as a Webhook URL in WooCommerce in order to convert the received data and then send it to a third party system, but the endpoint apparently is ...
0
votes
1answer
28 views

How can I find out if a specific plugin is active in WordPress from JavaScript?

I am building a dynamic Gutenberg block that needs to render differently according to active plugins. I know there is the PHP function is_plugin_active. Is there an equivalent or a "workaround" to ...
0
votes
0answers
11 views

embedded YouTube video the new download icon was displayed

I'm creating videos will played in YouTube once you click the image in our site.But unfortunately the download link icon was displayed automatically.Is there a way that i can remove the icon.enter ...
0
votes
0answers
9 views

Wordpress API - get random post

I connected to my Wordpress using API, I downloaded the last three posts and everything works as it should. However, is it possible for three other posts to be drawn after each code generation? He ...
0
votes
2answers
28 views

Upload data as image to Wordpress using Wordpress API

I am trying to take the URL of an image, download it, and then upload it to wordpress using the Wordpress API. Here is my code: def upload_media(self, media_url): # Get the last path component ...
0
votes
0answers
14 views

Wordpress Rest API change output Container

ive this code: function funct ( $data ) { return "hello"; } add_action( 'rest_api_init', function () { register_rest_route( 'wp/v2/xml/', '/linked', array( 'methods' => 'GET', 'callback' =>...
2
votes
0answers
39 views

How to fix non existent field in Gatsby GraphQL?

I use Wordpress, Gatsby + GraphQL and I want to build a blog. Unfortunately all blog posts needs to have all "features" for example featured image. The problem is when I remove all posts. So my blog ...
0
votes
0answers
11 views

Wordpress - Plugin to create options and retrieve from php file

I want to build a new page in wordpress that has a series of options that i can retrieve from any php file. What's the best approach for this? I need more of an options page no a post type, is a ...
3
votes
0answers
38 views

Modify WooCommerce REST API product image upload

I have to create and update products via WooCommerce REST API, without image uploads to media library (only the image source is need to be stored, because they are hosted on another server). In the ...
0
votes
2answers
30 views

How to expose all the ACF fields to Wordpress REST API in both pages and custom postypes

I want to expose all the ACF fields that belong to a page or custom post type to the WordPress REST API in order to do some API calls through javascript. The final expected result would be all the ...
3
votes
2answers
102 views

How to include META fields in Wordpress API Post?

I am using Wordpress version 5.2.1 which means I am not using a plugin for the WP API. I have working code which creates a new post (using a custom post type) on my WP site, all good there. The ...
3
votes
1answer
49 views

Wordpress API - how to add rest field to tags

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

Wordpress API and Angular cross origin policy violation

I know there's a lot of topics on this issue here but nothing seems to help. I've got an Angular 7 app running on http://localhost:4201 and a Wordpress site with REST API enabled. If I call http://...
0
votes
0answers
12 views

How to create a new response over the old one for the same endpoint from using register_rest_route in Wordpress PHP rest API?

I want to make a custom endpoint REST API for get posts with custom JSON. Previously, I can edit my response but later I cannot create a new response over the old one for the same endpoint. I'm new ...
0
votes
0answers
30 views

Wordpress connect external database and get information

"Ok, will try to summarize so it doesn't end-up being a mess of a question. I have a wordpress site, and i want to get information from my other site database to show in the wordpress one. What is the ...
0
votes
1answer
45 views

Remove custom postype base slug and prefix permalink with custom taxonomy + post title or just post title

What I want to achieve seems pretty trivial still the solution is yet to be found: I want to be able to avoid having the slug of the custom postype, (ie. article) and have in the permalink the ...
0
votes
1answer
21 views

How to GET rest json return from filtered perpage and specific page wordpress API link

I can get data per page with link myWeb.com/wp-json/wp/v2/posts?per_page=10 but how I can get data from page 2 and per_page=10, I wondering it would be like myWeb.com/wp-json/wp/v2/posts?per_page=10?...
0
votes
1answer
53 views

Converting an ajax call to a fetch api call and pulling the information into a php function

I'm trying to convert an .ajax call to a fetch call. The ajax works but the fetch pulls a 500 error when I try to pull the data in my wordPress php file. I'm fairly new to the fetch api and that is ...
-1
votes
0answers
15 views

How do I duplicate WP Page with the API?

I know there are several plugins for duplicating posts/pages. But how do I do that with the API?
0
votes
0answers
15 views

wordpress file upload problem with ionic3

I make Ionic3 with WordPress. my problem is file upload. I had change server (bitnami) .htaccess and also modify the function in the theme. ionic3 and native@file-transfer I follow up this code. ...
0
votes
0answers
18 views

Cleanup of WP REST API response

I have a problem with using WP REST API. I need to make an Android application which shows posts from a WP website (I already made one before, and it works perfectly). The problem is that this website ...
2
votes
1answer
38 views

Remove user and all its posts

I need to use WordPress Rest API to delete a user and all its own (maybe custom) posts. I tried to call <url_base>/wp/v2/users/<id> and I have to provide a further parameter ?reassign=...
0
votes
0answers
30 views

How to sort post randomly with WP REST API?

I am trying to display posts using the WP REST API and I want to display them randomly. I know querying the posts the normal way with wordpress there is a orderby: rand option, which would do what I ...
-2
votes
1answer
22 views

How to upload Video using Rest api in php?

I am trying to upload video using Rest api but it gives an error ": POST Content-Length of 69645141 bytes exceeds the limit of 8388608 bytes in Unknown on line 0" Does anyone know? Thanks in ...
0
votes
0answers
19 views

Can I use axios with Wordpress rest api within Phonegap's environment and get any permissions issues?

I am currently in the process of planning a mobile app for IOS and Android and coming to the conclusion (for this project) that I want to use axios in phonegaps environment and using Wordpress restful ...
0
votes
0answers
21 views

How To Change Wordpress REST API date into “time ago” format in Laravel [duplicate]

I would like to change the DATE FORMAT from the wordpress rest api - I have the following code: <div class="post-item"> <div id="posts">Loading posts...</div> $(document).ready(...
0
votes
1answer
14 views

How to add WP API and JS featured image attachment in Laravel

I would like to fetch the image from the wordpress rest api - I have the following code: HTML-blade: <div class="post-item"> <div id="posts">Loading posts... </div> ...
0
votes
1answer
33 views

How To Get Login Errors on Custom Login Form

I have created a custom login form through Elementor but can't output the error properly, breaks my site. I have made a bit of PHP code and amended it to try to collect the WP Errors from the WP ...
1
vote
0answers
58 views

Woocommerce REST API not working inside the plugin

I'm trying to make woocommerce plugin. I need to use woocommerce REST API. I tried REST API in localhost with single php file it works. But when I try to add that codes to the plugin. it doesn't ...
0
votes
0answers
28 views

How do I get individual posts from WordPress in a UIViewController?

The problem is: I do not know how to say my UITableViewController that every post is individual and when clicking on the post a new UIViewController opens and displays the contents of the respective ...
0
votes
1answer
19 views

How do you limit per_page results and display pagination links for custom WP REST API endpoint?

I have set up a custom WP REST API route and I need help limiting the results to 5 per page and then having pagination links to show the next page etc. I have tried adding 'per_page => 5' in the ...
3
votes
3answers
260 views

Swift and Wordpress API: Wordpress API escapes some characters to unicode

I'm copy-pasting 2 post title returned by Wordpress API: Haydarpaşa&#8217;da ortaya çıktı! Tam 1700 yıllık&#8230; Pakistan&#8217;da terör saldırısı I create structs for categories/posts ...
1
vote
0answers
16 views

WordPress Recurrence rule Parsing to determine Occurrence for Today

How to determine the WordPress Event has Occurrence for today. I wanna send Even JSON data to mobile where the event has occurred for today. I tried parsing the rule in client side(React Native) using ...
2
votes
2answers
57 views

What would regenerate a wordpress index.php file

So I have a client's site that has been hacked in the index.php file. The hack contains variables like this: $O0O_O00O__=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%...
0
votes
0answers
25 views

Can not authenticate a user who is not an administrator

I am building a flutter app and I want users to be able to authenticate using their wordpress credentials. I am using https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/#description and ...
1
vote
1answer
21 views

Regex in register route not working for parameters

I am working with a custom WordPress REST API endpoint and I want to be able to accept string and int values for the round parameter. This is because the round could be 1 (i.e. Round 1) or semi-final, ...
0
votes
1answer
32 views

File object from Buffer won't upload to WordPress

I have a front-end JavaScript application being used to manage a remote WooCommerce store. Among other things, the application is sending image files to a back-end application for resizing and storage ...
0
votes
0answers
34 views

Wordpress Custom REST API Endpoint not working getting error “No route was found”

I'm trying to create new custom REST API endpoint on Wordpress web application to integrate it with ReactJS. I used Wordpress inbuilt REST API calls which are working fine. I'm using Wordpress 5.0.3 ...
0
votes
3answers
48 views

How to fetch items in a map function for each ID

I am trying to fetch some data with the Wordpress API and i need to do this based on the restbase and ID. I have an array that looks like this: const array = [ { taxonomy: 'category', ...
0
votes
0answers
26 views

Wordpress v2 JSON API only filters by post ID

I have set up a custom post type CRM in Wordpress. I was positively surprised that it appeared with it's own model in Wordpress's Backbone API thing. I really wanted to get to understand it, but I've ...