[wp-trac] [WordPress Trac] #37020: get_rest_url() returns wrong path if the site and home url's are different

WordPress Trac noreply at wordpress.org
Fri Jun 3 20:49:38 UTC 2016


#37020: get_rest_url() returns wrong path if the site and home url's are different
--------------------------+----------------------
 Reporter:  adamf321      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  REST API      |     Version:  trunk
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------

Comment (by adamf321):

 Hey @rachelbaker ,

 I think the api should use `site_url()` and it does. For example:

 - my posts endpoint is found at: "http://lean.dev/wp-json/wp/v2/posts"
 (this is good, just what we want)
 - however get_rest_url( null, '/wp/v2/pages' ) returns
 "http://localhost:8005/wp-json/wp/v2/pages"
 - site_url() = "http://lean.dev",
 - home_url() = "http://localhost:8005"

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37020#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list