[wp-trac] [WordPress Trac] #32277: get_comment_reply_link() uses $_SERVER['REQUEST_URI'] for post link, not the actual post's link.
WordPress Trac
noreply at wordpress.org
Thu May 7 05:03:47 UTC 2015
#32277: get_comment_reply_link() uses $_SERVER['REQUEST_URI'] for post link, not
the actual post's link.
--------------------------+-----------------------------
Reporter: Shelob9 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 2.7
Severity: normal | Keywords:
Focuses: template |
--------------------------+-----------------------------
When `get_comment_reply_link()` is used to get the reply link, not the
login link, the post is generated from the use on ~L1416 of
`add_query_arg()` without specifying a URL, so the value of
`$_SERVER['REQUEST_URI']` is used.
This works perfectly fine when the function is called during a request for
a single post, but what if it is not? Then you end up with a link that
makes very little sense.
2 scenarios to consider:
1) You call this function during an AJAX request. You end up with the AJAX
API's URL as the base of the reply link URL. This is the actual scenario
that led me to report/ patch this. The link is still valid, but it looks
funny.
2) You want to output a reply link to post when not on a single post view.
I don't know what happens then, but I could have a lot of fun with the
ability to do so.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32277>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list