Make WordPress Core

Opened 12 years ago

Last modified 3 years ago

#2877 reopened defect (bug)

A Slash too much @ get_pagenum_link()

Reported by: dave@… Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.0
Component: Posts, Post Types Keywords: has-patch needs-unit-tests needs-refresh
Focuses: template Cc:


  • File: template-functions-links.php
  • Function: get_pagenum_link()

The following code is at the end of the function:

	// showing /page/1/ or ?paged=1 is redundant
	if ( 1 === $pagenum ) {
		$qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style
		$qstr = remove_query_arg('paged', $qstr); // for query style

If you work with the mod_rewrite style, you will get this URL for the first page:

http://www.example.com/wordpress/index.php/ This wont work (/ at the end).


	// showing /page/1/ or ?paged=1 is redundant
	if ( 1 === $pagenum ) {
		$qstr = str_replace('/page/1/', '', $qstr); // for mod_rewrite style
		$qstr = remove_query_arg('paged', $qstr); // for query style


  • sry for my bad english...
  • i've downloaded a german translation of wordpress 2.0.3, so maybe its just in this version... ?!

Attachments (3)

2877.diff (1.4 KB) - added by scribu 7 years ago.
2877.2.diff (1.4 KB) - added by jesin 3 years ago.
Refresh 2877.diff
2877-test.diff (891 bytes) - added by jesin 3 years ago.

Download all attachments as: .zip

Change History (13)

#1 @darkfate
12 years ago

No, it's that way in the english version. I don't think that would fix it and there would be a problem with that. Putting the slash in front like you did would make the server redirect to root. So if you have wordpress in a directory it would screw up like so: You would want this: http://site.com/wordpress/testing/1/ But you would get this: http://site.com/testing/1/

#2 @Nazgul
11 years ago

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

No traction in almost a year, so closing as wontfix.

Feel free to re-open it if you have additional information/suggestions/patches/...

#3 @scribu
7 years ago

  • Keywords needs-patch added
  • Milestone set to Future Release
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Only enhancements or feature requests can be closed when there's no traction.

7 years ago

#4 @scribu
7 years ago

  • Keywords has-patch added; needs-patch removed

#5 @scribu
7 years ago

Note that the problem is with first-page links, not with /page/2, /page/3/ etc.

Original thread: http://wordpress.org/support/topic/plugin-wp-pagenavi-trailing-slash-at-first-page-url-regardless-of-defined-permalink-structure

Last edited 7 years ago by scribu (previous) (diff)

#6 @nacin
4 years ago

  • Component changed from General to Template

Interesting patch.

#7 @nacin
4 years ago

  • Keywords needs-unit-tests added

#8 @nacin
4 years ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added

#9 @obenland
4 years ago

  • Keywords needs-refresh added

#10 @chriscct7
3 years ago

  • Version changed from 2.0.3 to 2.0

3 years ago

Refresh 2877.diff

3 years ago

Note: See TracTickets for help on using tickets.