#26871 closed defect (bug) (fixed)
wp_get_shortlink() returns post link for the home page
Reported by: | nacin | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.7 |
Component: | Posts, Post Types | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
wp_get_shortlink() was changed in [25030] to return links for public post types. It doesn't account for pages on the front page, though. Patch attached.
This was a regression from 3.6 -> 3.7.
Attachments (1)
Change History (10)
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
11 years ago
- Keywords needs-patch added; has-patch removed
Patch attached.
Looks like you forgot it.
#5
@
11 years ago
Tested this patch.
If the page in question is set as "Front Page displays: Front Page: <my test page>" then the "Get Shortlink" button does not appear next to the "View Page" button when editing the page.
When I change the "Front Page displays: Front Page" option to another page or "Your latest posts" and then go back to my page then the "Get Shortlink" button appears and can be used to get the page shortlink.
My guess is that is the required functionality although the patch, if I'm reading it correctly, would return the home_url if the "Get Shortlink" button was there, whereas I found that the button wasn't there to click in that scenario.
#6
@
10 years ago
- Keywords commit added
Verified that the Get Shortlink button is not supposed to show when the shortlink is equal to the permalink.
26871.diff looks to work as described.
This triggered a curious (and major) bug on jquery.com, as they directed nginx to cache pages and redirects but did not have query strings in their cache key.
?p=X
redirected to the home page, and this redirect got cached as / => /. Thus, the home page was issuing a 301 to itself. While I doubt this is going to be common at all, and the bug still existed (the link was simply broadcasted in this case), the front page is a prominent location and this is lame and crufty. Worth considering a point release fix; curious what others think.