WordPress.org

Make WordPress Core

Opened 7 days ago

Closed 6 days ago

#50218 closed defect (bug) (invalid)

rest_route is not passing query parameters

Reported by: masosky Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3.1
Component: REST API Keywords:
Focuses: Cc:

Description

Hi,

I tried to reach the Woocommerce API through http://localhost/wp-json/wc/v2 but I had to use the "rest_route" options because the "wp-json" endpoint is not available.

The problem is the following, I need to access to this URL:
http://localhost:3007/index.php?rest_route=/wc/v2/product and pass some query parameters

for example:
http://localhost:3007/index.php?rest_route=/wc/v2/product?a=1
if I try this, the route does not exists
Also if I try this
http://localhost:3007/index.php?rest_route=/wc/v2/product&a=1
It is not working

Why WordPress is not redirecting the parameters or headers when using "rest_route"?

It looks like a bug.

Thank you

Change History (4)

#1 @masosky
7 days ago

Sorry I did not mention that if I try to encode the URL the problem is also happening

For example:
http://localhost:3007/index.php?rest_route=%2Fwc%2Fv2%2Fproduct%26a%3D1

#2 @TimothyBlynJacobs
7 days ago

  • Component changed from General to REST API
  • Keywords reporter-feedback close added
  • Severity changed from blocker to normal

Hi @masosky,

Thanks for opening a ticket, and welcome to trac!

I'm not able to replicate, for instance the following URLs return what I'd expect.

http://wp-api.test/index.php?rest_route=%2Fwp%2Fv2%2Fposts&_fields=author
http://wp-api.test/index.php?rest_route=%2Fwp%2Fv2%2Fposts&author=3

Could you try calling a built in route instead of a WooCommerce route?

#3 @masosky
6 days ago

You are right,

It seems it is a Woocommerce problem.

Thank you for your fast response

#4 @SergeyBiryukov
6 days ago

  • Keywords reporter-feedback close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the follow-up!

This Trac is used for enhancements and bug reporting for the WordPress core software, not for third-party plugins like WooCommerce.

Please try their support via https://woocommerce.com/ or the support forums to get help with your site.

Note: See TracTickets for help on using tickets.