[wp-trac] [WordPress Trac] #9963: get_permalink() returns wrong link outside The Loop

WordPress Trac wp-trac at lists.automattic.com
Thu Jun 28 08:52:04 UTC 2012


#9963: get_permalink() returns wrong link outside The Loop
--------------------------+-----------------------
 Reporter:  fmorel90      |       Owner:  ryan
     Type:  defect (bug)  |      Status:  reopened
 Priority:  high          |   Milestone:
Component:  Permalinks    |     Version:  3.4
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+-----------------------
Changes (by iLobster):

 * status:  closed => reopened
 * version:  2.8 => 3.4
 * resolution:  invalid =>
 * severity:  major => normal


Comment:

 ryan: your solution may work for the specific presented problem, but I
 think there needs to be a uniform way to pull the current page's
 permalink, or more basically ID (with the id you can access the permalink)
 outside the loop without running custom queries such as
 [http://wordpress.org/support/topic/how-to-get-page-id-using-php?replies=5
 here] or relying on different combinations of $_SERVER which are not
 always uniform and reliable.

 My test case is a self submitting form where I prefer not to leave the
 action attribute empty. As the page ID is processed in the beginning of
 each page, it would make sense to copy it to another veritable that
 doesn't get overridden by the loop

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9963#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list