Questions tagged [endpoints]

Custom additions to permalinks for any kind of type (archives, posts, root).

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

php code for outputting a custom page in my account

I am trying to figure this out for weeks now. I added some custom endpoints to my woocommerce my-account page. All but one are linked with a shortcode and work fine. One should link to a normal ...
0
votes
0answers
11 views

Add all post meta data to rest api

I am trying to get all meta fields to automatically add to the rest api. I've found a lot of tutorials that mostly deal with adding specific fields only, not all fields. In the wordpress docs I was ...
2
votes
1answer
20 views

how to create endpoint for downloading pdf files?

I would like the logged-in user to be able to download the PDF file, but not to see the real path to the file. Additionally, in this PDF file, I enter information about the user name and date of ...
0
votes
1answer
71 views

Custom endpoint that returns an xml

I need to create an endpoint that when called returns an XML with the products of the store. I have the XML generated, but I don't know how to make the endpoint return it in XML format, because now it ...
1
vote
0answers
15 views

Continue execution after WP REST API response

I am trying to extend the Wordpress REST API with an endpoint that takes Zoom webhooks. Zoom requires a response within 3 seconds or will blacklist your endpoint address, but the processing that I ...
0
votes
0answers
32 views

How to add field to custom post type endpoint

I have an endpoint in this address: example.com/wp-json/wp/v2/myendpoint I want to add a field to the endpoint with these codes: add_action( 'rest_api_init', 'create_api_posts_meta_field' ); ...
0
votes
1answer
34 views

Custom Rest API POST endpoint with conditionally required parameters

I've spent the last 6 hours trying to figure this out, I'm likely being dumb. I'm trying to create a POST endpoint that has parameters that are required based on the value of another parameter. ...
0
votes
0answers
25 views

Sort custom endpoint API by number of views

I have registered a rest field in my functions.php for the API to show: register_rest_field( 'post', 'views', array( 'get_callback' => function ( $data ) { return get_post_meta( $data['id'], '...
0
votes
1answer
161 views

Do I need to create an endpoint?

Turns out I'm trying to integrate witei's CRM into a website. According to the witei documentation, I must indicate a url (webhook), where I want to receive the information of the properties that has ...
0
votes
0answers
52 views

What's the right way to validate JSON data coming from an AJAX POST request?

I'm building a little plugin with a send button: when clicked, the button calls (from the admin area) a rest api endpoint, passing JSON data through AJAX. Everything works very well and the callback ...
0
votes
1answer
39 views

Get UserInfo from Wordpress

I am building a website and trying to pull the data from Wordpress using the WP rest api. On wordpress, the WooCommerce plugin has been added so the user contain more info and I have added additional ...
0
votes
0answers
34 views

WordPress - replicate same globals, query vars and query for an alternate endpoint

We are building a hybrid mobile app for a website. The app will display a minimal version of the webpage, for example if the website displays post title, post content, sidebar, widgets, etc, then the ...
0
votes
1answer
82 views

custom endpoints on Custom Post Type return 404 page not found

I am trying to add custom end point url to custom post type posts. After much searching I have added the add_rewrite_endpoints to functions.php function psf_game_endpoints() { ...
0
votes
0answers
58 views

How to force JWT auth for default GET endpoints of Wordpress rest api?

The default GET endpoints (for e.g. http://scintec.net/wp-json/wp/v2/posts/) of the Wordpress Rest api are public and can be accessed by anyone. I am currently interacting with a Wordpress Rest api ...
0
votes
0answers
15 views

Wordpress Account Endpoints

I am very new to wordpress coding and would like some pointers and simple language to explain how I would create custom account endpoints that does specific functions. For example, I am using ...
0
votes
0answers
16 views

What is the best way to make a simple android app based on a wordpress powered site

What do you think it is the most reliable approach to make a simple Android app feed with wordpress content. It shoul be best to use a Webview to show entire responsive version or may be it is better ...
1
vote
0answers
267 views

Wordpress Rest API custom endpoint for RSS feed

I know how to register custom endpoints for Wordpress REST API and actually use it to output podcasts from my website like this: register_rest_route( 'myradio/v1', '/podcasts/(?P<id>\d+)', ...
0
votes
0answers
42 views

Mutiple url rewrite rules and get every params

I am creating a messaging system where I have 4 sections (1)inbox (2)sent (3)draft (4)unread so I decide to go with Wordpress add rewrite rules I already add one rewrite rule section. ...
0
votes
0answers
84 views

Display WooCommerce account endpoint to specific user role

Here I have created a custom My Account endpoint for listing all the Costumes in CPT for that logged in user. Currently this endpointfile is included in the main plugin php file ( my-awesome-plugin....
0
votes
1answer
50 views

Custom account page that accepts a query parameter

I am trying to add a new account submenu page that takes a query parameter. I have the following which works: add_action('init', function() { add_rewrite_endpoint('scheduled-order-create', ...
1
vote
0answers
40 views

Custom endpoint to get all custom taxonomy terms

I'm trying to build a custom endpoint to get all terms from custom taxonomy the taxonomy name is cats I'm using this code function wl_cats() { $args = [ 'numberposts' => ...
1
vote
1answer
35 views

Where to add one custom end point and its function?

I just need to register one custom end point and its function (simple code). Where should I add the code in the sources files of WP?
1
vote
0answers
71 views

Using WP-API and SSE not authenticating user ID

I am using the wp-api to create a custom endpoint for my data: add_action( 'rest_api_init', function() { register_rest_route( 'mb/v1', '/sse/', array( 'methods' => 'get', ...
2
votes
0answers
81 views

How to handle Gutenberg wp.data async errors?

When using wp.data.select('core').getEntityRecords(...), there is a special selector for loading states wp.data.select('core/data').isResolving(...). But what about actual errors -- backend validation ...
0
votes
1answer
259 views

Update block once an API request returns with a value

I've got a block that allows the user to enter a script when in edit mode, then sends this script to a REST endpoint which returns a WP_Post representing a media file which is then displayed to the ...
1
vote
1answer
1k views

Get post from custom REST endpoint in Gutenberg

I'd like to get a post object from a custom REST endpoint within a Gutenberg block. The REST endpoint returns as part of its JSON payload an array with a "post" key which contains the contents of the ...
1
vote
1answer
21 views

Is there anyway to format my EndPoint URL in WordPress?

I have wrote an endpoint in WordPress and it works just fine. The problem is with the URL. The current format of the URL request must be like this: https://iotkidsiq.com/wp-json/zaindob/v1/sync_order/...
0
votes
1answer
593 views

Implementing a URL Shortener

I want to create a URL shortener where I use a REST API endpoint request to get a shortened url, e.g.: mywebsite.com/wp-json/wl/v1/shorten?url=url-to-shorten.com Where I get a response with a ...
0
votes
1answer
172 views

WooCommerce Endpoints content

I have a custom plugin that is integrated with woocommerce. I want to display listing records in the user's profile and have successfully done so. Creating the end points. refreshing the permalinks. ...
0
votes
2answers
494 views

Is this a correct usage of ob_start() in my WordPress project?

I have extended WooCommerce to create a custom endpoint. This endpoint, points to a template that has a form to save user meta data. When the form is submitted I want it to redirect to another URL. ...
0
votes
0answers
439 views

How can I secure my custom rest api endpoint or add under a already existing rest group

Creating a custom REST Endpoint I search a way to secure the route with JWT or integrate my endpoint under Woocommerce rest routes which already has an authentication logic. The perfect solution for ...
0
votes
2answers
743 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 ...
1
vote
1answer
1k views

Creating an endpoint in wordpress

I'm writing a plugin that will allow some of my installs to talk to each other and share specific information. I wish to specify an endpoint such that example.com/path/here is where the other site can ...
0
votes
1answer
195 views

How to require files in a custom endpoint

I am working on a custom endpoint to handle ajax media uploads with media_handle_upload(). I have created a custom endpoint with a route that is tested and works, however when I try require the ...
0
votes
1answer
2k views

Can't get POST data in API endpoint callback

I have this: add_action( 'rest_api_init', function () { register_rest_route('my-project/v1/form', '/post', array( 'methods' => 'POST', 'callback' => 'post_form' ) ); }); I called ...
0
votes
1answer
804 views

Can I define multiple callback methods depending on the call method?

He is my current custom API: add_action( 'rest_api_init', function () { register_rest_route('my-project/v1/form', '/get', array( 'methods' => WP_REST_Server::READABLE, 'callback' => '...
1
vote
1answer
571 views

POST request not going through?

I'm still trying to see clearly in some aspects of the API. I have a custom route add_action( 'rest_api_init', function () { register_rest_route('my-project/v1/', '/form/post/', array( '...
4
votes
2answers
9k views

Why is my custom API endpoint not working?

I tried to include this code in my plug-in php files as well as in functions.php. (In the end I would like it to be in the plug-in's php file but I'm not yet sure if possible, that would probably be ...
2
votes
0answers
65 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
158 views

Custom route and query

I am trying to use a custom WordPress route and function, but I am getting a route and function not found error. Below is my code but I am not sure where it is breaking: add_action('rest_api_init', ...
0
votes
1answer
103 views

How to call code when adding WooCommerce menu items via woocommerce_account_menu_items

I'm inserting menu items similar to the code example at https://wordpress.stackexchange.com/a/277080/137417, but I haven't encountered endpoints before and the documentation and tutorial I've looked ...
0
votes
1answer
1k views

REST Endpoint API 404

I recently have been led to REST Endpoints within WordPress on another one of my posts. However following the guides/provided solution results in a 404 of the expected endpoint API url. My code is ...
1
vote
1answer
122 views

WordPress custom slug (endpoint) and compare all links

I work on the one i18n function. It will work with subdir. For example: eg.com/hello-world/en For this I'm support EP_ALL for the WP custom endpoints. function lang_add_endpoints(){ ...
0
votes
1answer
2k views

Associate the “add_rewrite_endpoint” and “$_GET”

I have an i18n class. The class find lang tag. For example: "?lang=en" And i want it work with subdir. For example: eg.com/en and eg.com/hello-world/en For this i am using: add_rewrite_endpoint ...
0
votes
1answer
182 views

How to fix AWS SNS API end point code that cause site not to load?

I'm trying to create an API endpoint in a Wordpress site that can receive AWS Simple Notification Service notification. I have this working now, but on the front end, the site does not load. Here are ...
1
vote
0answers
167 views

Manage custom post type in woocommerce /my-account/ page

I am hope for your help I have a custom post-type on my site - "Campaigns", I want to make that the user can on the page /my-account/campaigns was able to see the list of his posts, delete / edit ...
7
votes
2answers
2k views

In Gutenberg, now that withAPIData is being deprecated, how can I do an async call to a custom endpoint?

I have this working in my plugin and all is well with the world: edit: withAPIData( props => { return { roles: '/matt-watson/secure-blocks/v1/user-roles/' };...
0
votes
0answers
15 views

Debug info from request handler

I'm adding custom request handler using add_action and register_rest_root. Sometimes it's hanging and I'm stuck without any output. I would like to use something like echo "Label"; to debug my code. ...
1
vote
0answers
261 views

add_rewrite_endpoint returns 404 on archives

My endpoint works on all kind of single pages and homepage, but it returns 404 in archive pages, either categories or custom taxonomes. I have reflushed rewrites but I don't get it work. This is my ...
-1
votes
1answer
983 views

If YITH Wishlist page is set to the WooCommerce my-account endpoint, the endpoints stop working all together. Any solution?

When using YITH to display the wishlist in the my-account endpoint of WooCommerce, the wishlist works fine, but the endpoints stop working. If we change the page to anything else other than the my-...