Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#35647 closed defect (bug) (fixed)

API index should include home URL

Reported by: iseulde's profile iseulde Owned by: rmccue's profile rmccue
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords: has-patch
Focuses: Cc:

Description


Attachments (2)

35647.diff (686 bytes) - added by rachelbaker 8 years ago.
35647.2.diff (663 bytes) - added by rachelbaker 8 years ago.
Add home_url key to index

Download all attachments as: .zip

Change History (16)

#1 follow-up: @iseulde
9 years ago

Currently it is get_option( 'siteurl' ).

#2 in reply to: ↑ 1 ; follow-up: @rachelbaker
9 years ago

  • Keywords reporter-feedback added

Replying to iseulde:

Currently it is get_option( 'siteurl' ).

@iseulde where are you seeing this? get_rest_url uses get_home_url() to determine where the index and endpoints should be located.

#3 in reply to: ↑ 2 @rmccue
9 years ago

Replying to rachelbaker:

@iseulde where are you seeing this?

This is in the API index.

The use of siteurl is intentional, as it's intended to allow discovering the admin &c, but we should probably have a home value as well.

#4 @rmccue
9 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from URL at index should be the home URL? to API index should include home URL
  • Type changed from defect (bug) to enhancement

@rachelbaker
8 years ago

#5 follow-up: @rachelbaker
8 years ago

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

@rmccue I don't think we should be exposing the site_url without authentication at all. That isn't public info.

In 35647.diff I changed the index to use home_url()

#6 @rachelbaker
8 years ago

  • Keywords has-patch added; reporter-feedback removed
  • Milestone changed from Future Release to 4.5
  • Type changed from enhancement to defect (bug)
  • Version set to 4.4

#7 in reply to: ↑ 5 @rmccue
8 years ago

Replying to rachelbaker:

That isn't public info.

I disagree; it's available through links to XML-RPC (<link rel="pingback />, <link rel="EditURI" />, <link rel="wlwmanifest" />), any bundled scripts (<script src="wp-includes/js/..." />), plus wp-content URLs if it hasn't been moved. There are ways to remove it, but you can also remove it from the index via filters.

(Also, changing it now would be a BC break.)

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


8 years ago

#9 @Compute
8 years ago

#36250 was marked as a duplicate.

#10 @rachelbaker
8 years ago

@rmccue Okay, so site_url is not blatantly obvious, but discoverable.
By using the generic url key, our only option here for adding the home_url would be to add another key to the index. Suggestions for the new key name? Just home_url?

@rachelbaker
8 years ago

Add home_url key to index

This ticket was mentioned in Slack in #core by mike. View the logs.


8 years ago

#12 @Compute
8 years ago

  • Version changed from 4.4 to trunk

To me it's kinda "wierd" that the "url" is siteurl. We mostly put WP in a subdirectory so that the /wp-json/ url key would be "domain.com/wp/" - a link that would just result in a 404.

But I guess that the name can't be changed now due to backwards compatibility.

#13 @ocean90
8 years ago

  • Version changed from trunk to 4.4

The version field indicates the first version in which the issue was present.

#14 @rachelbaker
8 years ago

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

In 37031:

REST API: Add home_url to API index to avoid confusion with site_url.

Confusion abound, the API index is the generic term url to display the site_url. New home key will display the home_url in the index as well.

Fixes #35647.

Note: See TracTickets for help on using tickets.