Open ricardo opened 1 year ago
I did some digging into this and I only found these places where it's used and they are either tests or setup scripts
I also found this code that uses WooPay's wp-json endpoint
Using the get_rest_url()
function in my setup returns index.php?rest_route=
instead of /wp-json
. To get /wp-json
I had to use rest_get_url_prefix()
which is used in other parts of the code.
For the js tests and setup scripts I don't think we have a simple way to retrieve the rest api prefix.
IMO we shouldn't mind about the tests or setup scripts. 🙂
@leonardola Have you tried get_rest_url()
with a $path
parameter like this?
@leonardola Have you tried get_rest_url() with a $path parameter like this?
Yep it just changes the value of the rest_route
param
@c-shultz this one is obviously related to WooPay but doesn't show up on your board, could you please check?
Description
Original context: https://github.com/Automattic/woocommerce-payments-private/pull/34#discussion_r1160249523
In some places in the code we're assuming a few REST API endpoints contain the
/wp-json/
prefix. While this works by default, it can cause issues if the endpoint is changed. E.g with therest_url_prefix
filter.To prevent potential issues, we should update the code to use the
get_rest_url()
function to retrieve the REST API endpoint URL dynamically, rather than relying on a hardcoded string.Acceptance criteria
/wp-json/
should be replaced withget_rest_url()
instead.