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: |
|
Owned by: |
|
|---|---|---|---|
| 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)
Change History (11)
comment:1
szepe.viktor — 9 months ago
- Cc szepe.viktor added
comment:2
szepe.viktor — 9 months ago
comment:3
szepe.viktor — 9 months ago
so "page_on_front"
comment:4
szepe.viktor — 9 months ago
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
comment:5
wonderboymusic — 7 months ago
- 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()?
comment:7
wonderboymusic — 7 months ago
the default condition is everything else, including pages
wonderboymusic — 7 months ago
comment:8
wonderboymusic — 7 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
wonderboymusic — 7 months ago
Note: wp_link_pages() calls _wp_link_page() which is similar to get_pagenum_link()
comment:10
wonderboymusic — 4 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.

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