rest api – Proxy External API request in PHP from Edit.js in Block Plugin


I’m working with a third-party API that has optional filters on their API. I’m creating a block where the user has two select elements in Edit.js that are displayed on the backend of the block. They can select filters, specialty, and location, these values are then stored in attributes.

Once a user changes a select, I want to fire off a PHP request using these attributes passed to the PHP function that uses wp_remote_get() to build the proxy and dump the data into the rest point.

I have the Edit.js function setup but am unsure how to call the PHP function from the Edit.js file with the passed block attributes.

bbuilds 8 months 2022-05-31T20:05:40-05:00 0 Answers 0 views 0

Leave an answer