WordPress.org

Make WordPress Core

#21748 closed defect (bug) (duplicate)

get_pagenum_link() returns URL with pagination base for a singular paged content

Reported by: szepe.viktor Owned by: wonderboymusic
Milestone: Priority: normal
Severity: major Version:
Component: Permalinks Keywords: has-patch
Focuses: Cc:

Description

on this page I use an own plugin by a shortcode:

http://www.online1.hu/webdesign/

get_pagenum_link(2); returns

http://www.online1.hu/webdesign/page/2/

but it should make a difference:
front page: http://www.online1.hu/page/2/
other pages: http://www.online1.hu/webdesign/2/

Is it as bug??

Attachments (1)

pagenum-cases.diff (1.1 KB) - added by wonderboymusic 18 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 szepe.viktor20 months ago

  • Cc szepe.viktor added

comment:2 szepe.viktor20 months ago

my front page is a static page,
links are: /%year%/%monthnum%/%postname%/

Last edited 20 months ago by szepe.viktor (previous) (diff)

comment:3 szepe.viktor20 months ago

so "page_on_front"

comment:4 szepe.viktor20 months ago

four cases

URLs : get_query_var(), content relative to !--nextpage--



in case of page_on_front
/2/ : HTTP/404
/page/2/ : paged= page=2, after !--nextpage-- content

in case of a page
/2/ : paged=0 page=2, after !--nextpage-- content
/page/2/ : paged=2 page=, before !--nextpage-- content

Version 3, edited 20 months ago by szepe.viktor (previous) (next) (diff)

comment:5 wonderboymusic18 months ago

  • Keywords has-patch added

get_pagenum_link() shouldn't use $wp_rewrite->pagination_base on single posts

comment:6 duck_18 months ago

wp_link_pages() is the appropriate function to use for getting paged links for paginated posts as get_pagenum_link() is designed for archive pagination.

Supporting singular pagination in get_pagenum_link() as well might be a good idea though. However, looking at the patch (untested) it looks like it doesn't support pages. So, should it be checking is_singular() and not page_on_front, see _wp_link_page()?

comment:7 wonderboymusic18 months ago

the default condition is everything else, including pages

comment:8 wonderboymusic18 months ago

  • Owner set to wonderboymusic
  • Status changed from new to accepted

Patch refreshed to account for 1) search 2) posts / pages except for page on front 3) everything else

comment:9 wonderboymusic18 months ago

Note: wp_link_pages() calls _wp_link_page() which is similar to get_pagenum_link()

comment:10 wonderboymusic15 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from accepted to closed

Duplicate of #4463.

This is insane - I patched 2 different tickets and the diff was almost exactly the same. This one's a dupe then.

Note: See TracTickets for help on using tickets.