[wp-trac] [WordPress Trac] #40562: get_permalink($id) and get_permalink($id) get_post_permalink ($id) Return current page Url, not Url of requested ID

WordPress Trac noreply at wordpress.org
Tue Apr 25 14:14:27 UTC 2017


#40562: get_permalink($id)  and get_permalink($id) get_post_permalink ($id) Return
current page Url, not Url of requested ID
--------------------------+-----------------------------
 Reporter:  thefraj       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.7.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If I had a page (say) ID = 4 and then did:

 <a href="<?php echo get_post_permalink(4); ?>">the link</a>

 this will return the link to the current page, not the link of page ID = 4

 Your documentation suggests it would return the Url of page ID = 4 as
 detailed here
 https://developer.wordpress.org/reference/functions/get_post_permalink/

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40562>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list