WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#2792 closed defect (bug) (duplicate)

front page permalink discrepancy

Reported by: ryanscheuermann Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords: front page
Focuses: Cc:

Description

With the advent of the new "Show this page as the front page" option, calling get_permalink on that page still returns the full permalink.

For instance, if you choose a page called "Home" as your home page, get_page_link (with pretty permalinks enabled) returns "/home/". Shouldn't it return the siteurl instead?

The only issue I've encountered in doing this is when you try to get that page's attachment(s) permalinks, it returns the wrong permalink. That page's attachment permalinks become "/attachment/" (wrong->404) instead of "/home/attachment/" (correct). get_attachment_link calls get_permalink on its parent to get the root of the link.

Should get_permalink return the siteurl or the full permalink for that page?

Change History (7)

comment:1 @markjaquith9 years ago

It should return the siteurl.

We could just put a filter on wp_list_pages and do the switch there. That way, it won't mess with attachments.

comment:2 @ryanscheuermann9 years ago

wp_list_pages isn't the only place WP users access permalinks for pages, is it? What about those building site-wide navigation menus without wp_list_pages? Like me. :-)

comment:3 @markjaquith9 years ago

It's the only place I can think of. But it may be better to filter get_permalink() but disable the filter when dealing with attachments.

comment:4 @ryanscheuermann9 years ago

I agree with that. Why not nip the problem in the bud, right?

comment:5 @ryan9 years ago

There are patches for this and other issues on #2515. I'll commit those shortly.

comment:6 @mdawaffe8 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

#2515

Not really a dup, but it's all over there.

comment:7 @Nazgul8 years ago

  • Milestone 2.1 deleted
Note: See TracTickets for help on using tickets.