[wp-trac] [WordPress Trac] #5781: Restore correct permalink for
Pages when using post_permalink($post_id)
WordPress Trac
wp-trac at lists.automattic.com
Wed Feb 6 17:50:10 GMT 2008
#5781: Restore correct permalink for Pages when using post_permalink($post_id)
-------------------------+--------------------------------------------------
Reporter: josephscott | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5
Component: General | Version: 2.5
Severity: normal | Keywords: has-patch
-------------------------+--------------------------------------------------
When using pretty URLs post_permalink($post_id) still returned the
/?page_id=xx URL for Pages in -trunk. This was caused by #5607 (committed
on 10 Jan 2008) but I believe that was just a symptom of an existing logic
bug.
The problem unwound into _get_page_link($id), which expects there to be a
global $post available for use. But I could never find a place where that
was setup before _get_page_link($id) was being called. Since $id is
optional for that function the implication is if no $id was provided then
we assume you want to deal with the existing global $post. The reverse of
that should also be true, if you do provide an $id that implies that we
need to first go fetch the post details before trying to generate the page
permalink.
To that end I propose leaving in the change in #5607 and adding the logic
that if an $id was provided we call get_post($id) before building the
permalink for the page.
--
Ticket URL: <http://trac.wordpress.org/ticket/5781>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list