Function get_comment_link returns duplicate URLs for comments available at permalink
|Reported by:||GregMulhauser||Owned by:|
When paging is active, get_comment_link always returns URLs with "comment-page-", even when the comment is available at the post's permalink, creating two different URLs for reaching the same comment. Ideally (IMHO), all parts of WordPress should always use the same URL for reaching any given comment.
For example, the first comment of a post may be available here:
But get_comment_link returns:
It is partly the fault of get_page_of_comment that get_comment_link is doing this (depends on ascending vs. descending order), but unfortunately other functions, plugins, etc., may already be relying on get_page_of_comment continuing to work the way it does now. Since this behaviour can't easily be fixed in get_comment_link itself without also altering get_page_of_comment, I'd like to suggest that the value returned by get_comment_link simply be wrapped in apply_filters.
That way, users (or plugin authors) who would like to get rid of extraneous "comment-page-1" and similar duplicate comment URLs can 'fix' the output of the function to provide unique comment URLs, while those who don't consider it broken in the first place (and are happy to have multiple URLs for the same comment) can keep the existing behaviour.
All the best,
Change History (12)
comment:6 Viper007Bond — 5 years ago
- Milestone changed from 2.7.2 to Future Release
- Type changed from defect (bug) to enhancement
comment:10 GregMulhauser — 5 years ago
- Owner Viper007Bond deleted
- Type changed from enhancement to defect (bug)