[wp-trac] [WordPress Trac] #41277: Random post returned by get_permalink when on post type archive

WordPress Trac noreply at wordpress.org
Sat Oct 28 20:31:52 UTC 2017


#41277: Random post returned by get_permalink when on post type archive
--------------------------+------------------------------
 Reporter:  espellcaste   |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Permalinks    |     Version:  4.8
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by lopo):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 I checked and it doesn't return a random post, but the first one of the
 archive loop, as stated by
 [https://developer.wordpress.org/reference/functions/get_permalink/ 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."

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41277#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list