Opened 4 years ago

Last modified 3 years ago

#9324 accepted defect (bug)

Let wp_link_pages do pagination when static page is used for front page

Reported by: ev3rywh3re Owned by: sorich87
Priority: normal Milestone: Future Release
Component: Template Version: 3.0
Severity: major Keywords: needs-patch
Cc: sorich87@…

Description

Mentioned on WP-Hackers. If a static paginated page is used for the front page and wp_link_pages is used in the theme, the pagination links will return 404 because get_permalink will return the front page URL as the root of paginated links. I marked it as a bug since it can cause 404 errors if you don't know about it.

The enclosed patch tests for is_front_page and static pages using alternate _get_page_link functions for paginated content and using get_permalink for standard paginated links. It even works when a child page is set for the front page.

This was a quick patch from a custom function, so it could probably be written a little better.

Attachments (3)

wp_link_pages-r10773.diff (3.4 KB) - added by ev3rywh3re 4 years ago.
Updated wp_link_pages for paginated front page
9324.diff (4.1 KB) - added by Denis-de-Bernardy 4 years ago.
link-template.patch (2.8 KB) - added by sorich87 3 years ago.
patch updated for 3.0

Download all attachments as: .zip

Change History (15)

Updated wp_link_pages for paginated front page

  • Keywords needs-patch added; wp_link_pages has-patch needs-testing removed

-1 to the patch. we should fix the 404 error that is spit by the query parser instead.

  • Keywords has-patch tested added; needs-patch removed

mm, looked a bit deeper into this, and the issue is a bit trickier in fact. based on the rewrite rules, the same issue is also valid for feeds.

on a static front page, the site.com/feed is that of the site (as it should), rather than for that page. so this should be fixed as well, and +1 to the patch's approach.

confirming that the patch fixes the issue.

and the static front page's comments feed url should get the same treatment.

  • Keywords commit added
  • Severity changed from normal to major

updated patch combines ev3rywh3re's patch and the fix to the single_feed() function

  • Owner changed from anonymous to Denis-de-Bernardy
  • Status changed from new to accepted
  • Keywords early added
  • Milestone changed from 2.8 to 2.9

can wait a little longer, even if the patch works.

still applies clean

  • Owner Denis-de-Bernardy deleted
  • Status changed from accepted to assigned

comment:8   ryan4 years ago

  • Milestone changed from 2.9 to Future Release
  • Keywords needs-patch added; has-patch tested commit early removed

borke patch

  • Keywords needs-refresh added; needs-patch removed

patch updated for 3.0

  • Cc sorich87@… added
  • Keywords has-patch added; needs-refresh removed
  • Owner set to sorich87
  • Status changed from assigned to accepted
  • Version changed from 2.8 to 3.0
  • Keywords needs-patch added; has-patch removed

Patch is broken.

Note: See TracTickets for help on using tickets.