Questions tagged [wp-api]
The wp-api tag has no usage guidance.
219 questions
0
votes
0
answers
15
views
how to combine wordpress and front framework
I saw this website kzero and they make 3D websites with WordPress, using the WordPress API. Can anybody explain which framework they use and how?
0
votes
0
answers
26
views
i need to resive data external api and show user
i have one form for user , this form send code to external api and i need show user callback responce api this page and not ind plugin for this work (for show responce api current page for user )
i ...
0
votes
0
answers
74
views
list all gutenberg blocks properties with icon name as well
function custom_blocks_api_get_blocks()
{
$blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
$block_data = array_map(function ($block) {
return [
'...
1
vote
0
answers
114
views
not saving the WC_Session_Handler session and removing the product from the cart session in WooCommerce's custom rest api
I have spent almost two days on this problem.
I want to write a dedicated REST API for WooCommerce that removes a product from the user's shopping cart.
I delete the product, but unfortunately the new ...
0
votes
0
answers
18
views
Trouble Fetching Posts Using WordPress API: No Response from Specific Category
I'm facing difficulties while retrieving posts via the WordPress API, specifically when attempting to fetch posts from a particular category. Here's the issue in detail:
Fetching Posts by Category:
...
1
vote
0
answers
43
views
Wordpress Custom API GET request from External App with XML Parameter
I am new to WordPress API's and API's in general. I have an external app that is sending a GET request to my WordPress site with an XML string as the only parameter. I created a custom API that ...
0
votes
1
answer
103
views
Trying to create and update wordpress from python library
The Background:
I am a software developer that is trying to create a sports analytics website. I used to created wordpress-based sites on the side so I have a WHM where I can host sites. I'd prefer ...
0
votes
1
answer
39
views
How to submit a button automatically after every scheduled hours?
How to submit a button automatically after every scheduled hours ? I tried some JavaScript but all failed.
What I am doing?
I am trying to fetch product categories from an external API
Why I want ...
0
votes
1
answer
238
views
Adding Microsoft Teams Incoming Webhook to WordPress, Problem with Rest Route?
I am trying to implement an incoming webhook on my WordPress website to send a message to MS Teams when I receive a form submission. The message includes an ActionCard with a multiple choice input ...
0
votes
1
answer
1k
views
Custom post type REST api 404: Updating failed. No route was found matching the URL and request method
I have registered a new post type as:
$this->sconfig= ['post_type'=> 'event', 'slug'=>'events'];
add_action('init', array($this, 'register_event_posttype'));
and
function ...
0
votes
2
answers
1k
views
External api call using wordpress
I want to start a new website and chose wordpress as my cmd, but im having a restriction. The website is all about api request to other websites and i triedto get an api to test it as an example. ...
-1
votes
1
answer
87
views
How can I create a custom plugin to call webapi after user registration?
I want to ask how can i call my webapi after any user is registered in users table then my api is call and data is same data is send on that api
0
votes
0
answers
46
views
API request forbidden when requesting from same domain
I have a custom API endpoint that is rejecting calls being made from the same domain.
EG: I can request .../wp-json/darts/v1/venues from Postman (or CURL) and get a 200 response and the expected list ...
0
votes
0
answers
51
views
get_post_thumbnail_id() not getting correct featured image after post edited
Hy, everything works fine until I change featured image by editing post, using
wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),"full")
I get the url to the original picture, ...
0
votes
1
answer
104
views
How can I use React packages with the clasic editor?
I'm trying to add some extra functionality when editing a post using the classic editor, so that when the user clicks the Update button to save the post, I want to show a React component that will ...
0
votes
0
answers
516
views
Cant create or update meta fields using WordPress REST API
I have wp theme with custom fields in posts with following meta keys in photo, can't create post with custom fields values using rest-api (I'm able to create posts with no problem but cant edit or add ...
1
vote
0
answers
226
views
update_callback is not working in register_rest_field
I am registering a new field in my custom post type using register_rest_field.
But I am unable to add/update the field using the rest API of post add/edit. However, the get_callback function is ...
0
votes
1
answer
75
views
Get single item from cURL plugin API call inside bash [closed]
I'm trying to get only the last_updated date from a plugin through an API call in a bash script.
I'm trying to use cURL but that's giving me some issues. On the browser I can get to to plugin like ...
0
votes
1
answer
521
views
Getting featured image with PHP and not javascript from wordpress api _embed [closed]
Not having access to the functions file, I can't add the function to add the featured image to the API so I need to use wp-json/wp/v2/posts?_embed.
With javascript I believe it is ._embedded['wp:...
1
vote
1
answer
591
views
Display post title from WordPress excluding a string via API
Imagine you have custom post types - Users.
There are fields for each user as the post title, description, image, and rules.
All titles are names of the Users and all they have Mr. before the names.
...
0
votes
2
answers
2k
views
Wordpress REST API - get custom taxonomy category posts
I want to use Wordpress REST API to get the posts that are inside a custom taxonomy created by the theme.
The taxonomy is called "my_portfolio" but if I use this I have this response:
{&...
0
votes
0
answers
252
views
Allow REST API Endpoint to specific user and hide from public
So I've been working on trying to figure this out, but I can't seem to get the right answer or even find docs online regarding this issue, so I'm reaching out to the community to see if I can get some ...
1
vote
0
answers
34
views
Create a custom post with custom post-metadata with WP API
I'm using WP API to insert a custom post in Wordpress. The custom post is "property".
What I now need to do is assign that post a "metadata" (DB table "wp_postmeta")
At ...
0
votes
0
answers
57
views
How can I create new CustomPostType record using wp.api.collections?
I would be very grateful for your help. Already racked my brain for today!
So, I used the CPT UI plugin and created my custom post type with it. Immediately when setting it up, I enabled RestAPI ...
1
vote
0
answers
301
views
Create a range slider to change font-size with different screens sizes in wordpress customizer api
I have been trying to create a theme customizer to change the font size. To do that I have created settings and control. But the issue is I am unable to achieve like as shown in the image. I have used ...
0
votes
1
answer
755
views
How to change the date and time in REST API for comments?
/**
* Add a Formatted Date to the WordPress REST API JSON Post Object
*
*/
add_action('rest_api_init', function() {
register_rest_field(
array('comment'),
'formatted_date',
...
0
votes
0
answers
61
views
Check if user can in javascript
Using the rest API I retrieve a collection of posts:
const recordsParams = {}
const recordsCollection = new wp.api.collections.MyPostType();
recordsCollection.fetch( { data: recordsParams } )
....
1
vote
1
answer
615
views
wp-api Backbone JS Client fetch options
I’m making a webapp based on wordpress in which I’m using the REST API for my users to get and create posts.
I found the very useful REST API backbone javascript client which seems great.
However the ...
0
votes
1
answer
932
views
How to create WordPress custom end point with multiple parameters?
I want to get all WooCommerce orders from given date range. I can retrieve all orders at once. But I am confusing with passing the date range via API URL.
Can anybody help me with this? I know it's ...
0
votes
1
answer
190
views
Is there a way to download only the Rest API part of WordPress?
Is there a way of downloading only the Rest API part of WordPress and not all the old PHP files?
0
votes
1
answer
446
views
Custom Endpoint API based on attribute gutenberg block
I need to return all posts that have the value of a specific attribute that is saved in the custom block attributes gutenberg. This value in the query will be according to the endpoint below.
http://...
2
votes
0
answers
1k
views
is_user_logged_in not working from WP-API (wp-json)
I want to hide certain posts from visitors that are not logged in. The code below works perfectly when the visitor visit the page but not is I try to see all the pages from the API with wp-json/wp/v2/...
0
votes
1
answer
699
views
How to see posts in taxonomy endpoint
I am looking at a custom taxonomy endpoint and there are custom post types for this taxonomy but they don't show in the endpoint. Is there something I need to add to this endpoint or something to the ...
0
votes
1
answer
186
views
Get a complete list of all categories using node-wpapi
I'm trying to get a complete list of all categories using node-wpapi. But I can not do that.
I use wp.categories(), but it only returns a response containing up to 10 categories.
Actually, there are ...
2
votes
2
answers
890
views
Keep getting 401 error from WordPress on AWS Lightsail
I'm trying to post to a WordPress server on an AWS Lightsail instance using node-wpapi.
However, the server returns a 401 error.
I already have a .htaccess file with RewriteRule .* - [E=REMOTE_USER:%{...
1
vote
1
answer
349
views
is it possible to filter a rest api endpoint by using a registered rest field?
I added a rest field into a custom post type endpoint as following:
function artists_per_building() {
register_rest_field( 'building',
'artists',
array(
'get_callback' => '...
0
votes
0
answers
276
views
do_action in API call
I have a woocommerce plugin and it provides an API url ?wc-api=myplugin.
The plugin adds a new email also.
function add_newstatus_woocommerce_email( $email_classes ) {
require( 'emails/class-...
0
votes
1
answer
2k
views
why woocommerce api only do not upload images from local computer? [closed]
I want to upload images on my computer to a wordpress website, however the woocommerce api is only working well with everything except images on my computer.
Here is the code I am using when it works ...
0
votes
0
answers
248
views
upload image to wp-api
I am using a localhost external website, that isn't wordpress related, and I want to upload an image to wordpress, possibly needs to be with wordpress api, however I would like to know how to connect ...
0
votes
2
answers
2k
views
How to upload image to wordpress from external page
I have a webpage on localhost that do not have wordpress environment, I had use woocommerce api to create the product, however woocommerce api doesnt seem to upload the image.
I want to create the ...
0
votes
0
answers
187
views
wp_update_user very slow
I am changing a user role with a custom endpoint. If the ID is incorrect, it fails right away and I get my error message. If it is successful however, the role is updated in the backend right away but ...
1
vote
1
answer
1k
views
WP_REMOTE_POST Requests are being blocked by API provider [closed]
I'm trying to make some API POST requests via WordPress' own method i.e. wp_remote_post()
Here is the sample code I'm using:
$args = array (
'sslverify' => false,
'headers' => [
'...
0
votes
0
answers
217
views
WP-API call function
I'm sorry, I speak a little English.
My website API: https://examplee.tld/wp-json
If visit my API please run my own plugin: https://examplee.tld/wp-content/plugins/myplugin/myplugin.php
<?php
/**
...
1
vote
1
answer
2k
views
React post to WordPress custom post type
I am not sure if this is the right way to do it but I have a react site using WordPress API as the backend. I want to store my contact form entries in WordPress so I created a custom post type
...
1
vote
0
answers
46
views
WordPress API for search
I have a search form for users on my website. I have a custom field called 'location' which is a country dropdown. If I type in a user's name and select a country from the dropdown I see this in the ...
1
vote
0
answers
163
views
Use the backbone.js client to save custom post type meta
So I have this small piece of code that renders an array of IDs:
const selected = this.$data.list.selected;
function get_ids(input, field) {
const output = [];
for (let i=0; i < input....
0
votes
1
answer
82
views
Are there events pub/sub for external application to subscribe to file/pdf uploads by wordpress admin
I have a scenario where a wp admin wants an external application to listen and detect when a pdf has been uploaded to a directory within wordpress.
Ex: a new terms and condition (T&C) document is ...
0
votes
0
answers
322
views
Escape commas in REST API
Sending metadata through the REST API like this, is creating multiple entries because of the commas
meta: {
plugin_rule_what: 'discount_percentage',
plugin_rule_applies_multiple_options:'product_22119,...
5
votes
1
answer
465
views
Are there server performance benefits to fetching only specific fields when querying the REST API?
I understand that having less data being downloaded improves the experience to the end user, but my question is related to the actual server performance, would the response be faster?
I am fetching ...
0
votes
1
answer
87
views
How can I spin up a new website for a registered user automatically?
We have created a bunch of custom plugins at our agency, and the whole packaged website is like a 'product' at hand.
Is there a way to scale this in a way that we can give out a free trial, where when ...