get_permalink() returns wrong link outside The Loop
|Reported by:||fmorel90||Owned by:||ryan|
I'm using wp_logout_url(get_permalink()) in a sidebar widget to let users logout and return to the current page.
When viewing a single post, get_permalink() returns the posts' correct link.
However, on my home page, on archive pages, and on search results pages, get_permalink() returns the link of the last post in The Loop used to display posts in the page. I've checked both my theme and the default theme to see if I'd screwed up The Loop, but the default theme does this as well.
I am unsure if it worked correctly in 2.7. It's been a few months since I played with WordPress and I just started again with 2.8 a few days ago. However, I'm sure I would have noticed this before, so I'm putting this as a bug in 2.8.
If I take out The Loop on my homepage, it returns the link to my latest post.
Change History (10)
- Summary changed from get_permalink() returns wrong link after The Loop to get_permalink() returns wrong link outside The Loop
- Resolution invalid deleted
- Severity changed from major to normal
- Status changed from closed to reopened
- Version changed from 2.8 to 3.4