Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#40014 new defect (bug)

& converted to '#038

Reported by: fervillz's profile fervillz Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.2
Component: Themes Keywords:
Focuses: Cc:

Description

Hi guys,

This is a follow-up to #30831.

Using WordPress v4.7.2 . With paginate_links() and setting the 'add_args' to an an array of values breaks the url. Specifically replaces & with #038;

Sample code below:

echo paginate_links( 
    array(
       'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
       'current' => max( 1, get_query_var( 'paged' ) ),
       'total'   => $query_object->max_num_pages,
       'format' => 'page/%#%',
       'add_args' => array( 'project' => 1 /* or whatever the project number is*/ ),
) );

The code above replaces & with #038;

Sample result: http://domain.com/?page_id=1&paged=2#038project=1

Attachments (1)

URL-string.png (499.5 KB) - added by subrataemfluence 8 years ago.
Neither Address bar not the Status bar has converted '&' to '#038'

Download all attachments as: .zip

Change History (4)

#1 @subrataemfluence
8 years ago

Yes, the link you provided does change & to #038 but for me it did not happen. I am using the similar code:

echo paginate_links(array(
   'total' => $query->max_num_pages,
   'format' => 'page/%#%',
   'add_args' => array( 'place' => 1, 'type' => 4),
));

URLs still come up as http://local.tourplanner.com/page/2?place=1&type=4.

Browser: Chrome
WP Version: 4.7.2
Theme: Custom (no child theme)

Two differences between yours and mine are:

  1. My site is still in localhost while yours is hosted
  2. I am using a theme built from scratch, no parent theme used, although I believe that should not make any difference in this case.

Screenshot attached. Neither Status bar nor the Address bar has converted & to #038.

@subrataemfluence
8 years ago

Neither Address bar not the Status bar has converted '&' to '#038'

#2 @fervillz
8 years ago

Hi @subrataemfluence,

Hmm. Can you try to modify your Permalink Settings to the default 'Plain' .

Last edited 8 years ago by fervillz (previous) (diff)

#3 @subrataemfluence
8 years ago

For me its absolutely fine with "Plain" in permalink settings as well.

http://prnt.sc/efe2rp

Note: See TracTickets for help on using tickets.