Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#31060 closed defect (bug) (duplicate)

URL Query strings get escaped and become unusable (observed with function get_pagenum_link() )

Reported by: fraenk Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: General Keywords:
Focuses: Cc:


The problem can be reproduced by using a code example from the codex: http://codex.wordpress.org/Function_Reference/paginate_links#Basic_Example

global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
	'format' => '?paged=%#%',
	'current' => max( 1, get_query_var('paged') ),
	'total' => $wp_query->max_num_pages
) );

prerequisite is to have the default permalink structure active (not pretty permalinks)

it appears as if get_pagenum_link() returns the url with broken query parameters by giving #038; instead of an ampersand.

esc_url is NOT the culprit!

some more detail here: https://wordpress.org/support/topic/url-problem-038-replaces-and-breaks-the-navigation?replies=2#post-6456295

Change History (2)

#1 @SergeyBiryukov
6 years ago

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

Duplicate of #30831.

#2 @fraenk
6 years ago

Thanks Sergey!

now I know the proper workaround! I did not find #30831 when searching for an already existing ticket.


Note: See TracTickets for help on using tickets.