#41277 closed defect (bug) (invalid)
Random post returned by get_permalink when on post type archive
Reported by: | espellcaste | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8 |
Component: | Permalinks | Keywords: | |
Focuses: | Cc: |
Description
get_permalink has an odd behavior when on post type archives.
It fetches a radom article from the taxonomy archive, instead of returning the link from the archive itself.
Maybe it was supposed to. But if I do this:
<a class="button" href="<?php echo wp_login_url( get_permalink() ); ?>">
When the link is on a category archive, it will redirect the user to a radom article from that particular category, because the get_permalink is returning that particular random post.
Change History (3)
Note: See
TracTickets for help on using
tickets.
I checked and it doesn't return a random post, but the first one of the archive loop, as stated by the documentation:
"Note that when used outside The Loop on a posts page (index, archive, etc.) without the ID parameter, it will return the URL of the last post in The Loop, not the permalink for the current page."