Opened 9 months ago

Closed 4 months ago

#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
Priority: normal Milestone:
Component: Permalinks Version:
Severity: major Keywords: has-patch
Cc: szepe.viktor

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 7 months ago.

Download all attachments as: .zip

Change History (11)

  • Cc szepe.viktor added

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

Version 1, edited 9 months ago by szepe.viktor (previous) (next) (diff)

so "page_on_front"

four cases

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



in case of the front page
/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

Last edited 9 months ago by szepe.viktor (previous) (diff)
  • Keywords has-patch added

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

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()?

the default condition is everything else, including pages

  • 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

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

  • 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.