WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#4134 closed defect (bug) (fixed)

next_posts_link outputs a trailing question mark

Reported by: charle97 Owned by:
Milestone: 2.2 Priority: normal
Severity: normal Version: 2.2
Component: Template Keywords:
Focuses: Cc:

Description

next_posts_link outputs a trailing question mark on any page 2 when using clean urls.

Attachments (1)

questionmark.png (16.4 KB) - added by rob1n 8 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 @rob1n8 years ago

  • Priority changed from low to normal

Yep. Reproduced.

comment:2 in reply to: ↑ description ; follow-up: @charle978 years ago

commenting out the line

$qstr = remove_query_arg('paged', $qstr); for query style

in get_pagenum_link seems to fix it. i don't know how it affects the other permalink styles.

comment:3 in reply to: ↑ 2 @charle978 years ago

further isolated the problem to add_query_arg.

specifically line 797 for query style and line 801 for clean urls:

791 	    if (strpos($uri, '?') !== false) {
792 	        $parts = explode('?', $uri, 2);
793 	        if ( 1 == count($parts) ) {
794 	            $base = '?';
795 	            $query = $parts[0];
796 	        } else {
797 	            $base = $parts[0] . '?';
798 	            $query = $parts[1];
799 	        }
800 	    } elseif (!empty($protocol) || strpos($uri, '/') !== false) {
801 	        $base = $uri . '?';
802 	        $query = '';
803 	    } else {
804 	        $base = '';
805 	        $query = $uri;
806 	    }

@rob1n8 years ago

comment:4 @rob1n8 years ago

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

(In [5267]) trim() question marks *after* concatenating the string. fixes #4134

Note: See TracTickets for help on using tickets.