Questions tagged [wp-api]
The wp-api tag has no usage guidance.
205
questions
0
votes
0
answers
11
views
Cannot use WordPress Application Passwords: "code": "rest_no_route" "status":404 for /wp-json/wp/v2/users/me/application-passwords
I am trying to use Application Passwords on Wordpress 5.9 for the development of a client app.
The page https://www.example.com/wp-admin/authorize-application.php shows the Application Passwords ...
1
vote
1
answer
52
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
0
answers
42
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
10
views
How to display relations via wordpress Rest API
I have a CPT with relations i made and i need the relations to be sent via API Request. i edited it already so i can now see all meta fields in the API request but i cant get the relations to show. ...
0
votes
0
answers
20
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
22
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
14
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
55
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
159
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
19
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 } )
....
0
votes
0
answers
17
views
cannot get global $menu value in form request
I have register a route for edit_audience
register_rest_route( 'ilms_plugin', 'edit_audience', [
'methods' => 'POST',
'callback' => 'edit_audience',
'permission_callback' => '...
0
votes
1
answer
133
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
28
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
63
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
100
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://...
0
votes
0
answers
59
views
How do I update an XProfile “checkbox” type field via BuddyPress API?
I’m working on a mobile app to interface with a BuddyPress 9.0.0 website via the BP API. The website has some xprofile parent fields of the “checkbox” type, each with a set of “options” which the user ...
0
votes
0
answers
277
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
101
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
59
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
249
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
54
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
84
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
193
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
71
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
180
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
51
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
443
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
59
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
674
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
27
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
47
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
27
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
69
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
118
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
43
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 ...
0
votes
1
answer
272
views
register/login api
I have been looking all over google and all I can find is fairly old plugins that appear outdated in assisting with an API registration/login.
Basically, I have a mobile app that needs to get data ...
0
votes
0
answers
732
views
WordPress REST API in Integromat: How to overcome “Sorry, you are not allowed to list users / edit this…”
I am attempting to connect Integromat to my WordPress install.
I have successfully enabled visibility of custom post types in Integromat by registering my custom post types with show_in_rest. (And, ...
0
votes
0
answers
436
views
CallBack URL for payment gateway redirecting to homepage instead of executing callback function
I am working on a payment plugin for Woocommerce which requires that I set the URL to redirect after payment. I set this as home_url('/?').'wc-api=WC_Payment_Gateway'.
The payment gateway appends ...
1
vote
1
answer
254
views
Cache WP remote_get HTTP Response using Transients
Using wp_remote_get keeps pinging the API on every page load. Which increase the server resource.
Is it possible to cache the response of the API store it using Transients and use it for next 5 ...
1
vote
0
answers
101
views
Get non-rendered content from WP-API
I'd like to get the content of certain fields non-rendered, so for example get the excerpt text without WP adding the <p></p> tags. Is this possible without having to go into PHP, so just ...
1
vote
1
answer
1k
views
How to retrieve custom meta term of category taxonomy from WP Rest API?
First I added custom meta term called Color for Category taxonomy, see the code below
Add new colorpicker field to "Add new Category" screen
function colorpicker_field_add_new_category( $...
0
votes
1
answer
17
views
How do i post data to url with fields?
I am trying to post some data to a website called Jira and create a new issue there with the data I send.
I did try it with postman and it works! But now I just need to implement this in code. So far, ...
1
vote
1
answer
850
views
Post body not working with wp_remote_post()
I'm trying to post with with the following code
$userTokenApi = 'https://api.mindbodyonline.com/public/v6/usertoken/issue';
$args = array(
'headers' => array(
'Content-...
0
votes
1
answer
3k
views
403 error rest_'cookie_invalid_nonce' on API Request
I'm currently developing a Plugin in which I'm in need of retrieving information from a third-party plugin API.
To authenticate my users, I am trying to use the vanilla authentication via cookie as ...
0
votes
0
answers
29
views
How to use following API with WordPress?
I have an old client who wants to integrate one system on their WordPress website.
The company is fairly new called LYFSIZE which basically takes the picture of the users and provides them the exact ...
0
votes
1
answer
937
views
Uploading a media item with the wp-json API to a specific path
I'm using the WP-JSON API to import all my posts from my live site to my development site. It's working fine for posts, categories and authors, but when I upload my images, the API treats the files as ...
0
votes
0
answers
27
views
Help to create the best plugin settings!
Can you help me about how to create the best WordPress settings for plugins?
I have a custom setting page and I need to create some field with WordPress API.
Actually I use this solution: https://gist....
0
votes
0
answers
170
views
Remove unwanted fields from WP API response
I am making a mobile app that links to a Wordpress site. There are a lot of unwanted data from the API response and it would be great if I could remove it.
How could I do that without touching the ...
0
votes
2
answers
3k
views
WordPress REST Api get posts by ID
Hi I'm building up a WordPress rest API's custom endpoint on my project. I'm using the following code to get the single response from the website.
function get_single_post( $request ) {
$...
1
vote
2
answers
332
views
WP Rest API get page from path
I am looking to use the rest API to use WordPress as a headless CMS, but I am curious as to how best to get a page using the path.
Example, if Wordpress is hosted at cms.example.com and my frontend ...