WordPress.org

WordPRess GSoC Trac

Opened 7 months ago

Closed 7 months ago

#375 closed defect (fixed)

Incorrect wp-json.php URL when in sub-directory

Reported by: nikolov.tmw Owned by: rmccue
Milestone: 2013 Final (1.0) Priority: normal
Component: JSON REST API Keywords:
Cc:

Description

If you have your WordPress files situated in a sub-directory(let's say /wordpress/) all of the URL's that come from get_json_url() would be like http://example.com/wordpress/wp-json.php - that's obviously not correct, since the rewrite rules don't include the "wordpress/" part.

The solution to this is really simple - just switch get_site_url() for get_home_url() in plugin.php#126 - pretty much the same function, but it returns the URL for the home page of the site, thus making the location of wp-json.php correct.

PS: I hope that's the correct place for this bug report, even though it's almost the end of GSoC.

Change History (2)

comment:1 rmccue7 months ago

  • Owner set to rmccue
  • Status changed from new to accepted

Thanks for this, I realised this the other day but forgot to file the issue.

comment:2 rmccue7 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 2341:

Ensure the JSON URL is relative to the home URL

Fixes #375, but will break the PATH_INFO fallback when integrated into core. To
be investigated...

Note: See TracTickets for help on using tickets.