Make WordPress Core

Opened 7 years ago

Last modified 7 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:


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( 
       '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:

Attachments (1)

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

Download all attachments as: .zip

Change History (4)

#1 @subrataemfluence
7 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

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.

7 years ago

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

#2 @fervillz
7 years ago

Hi @subrataemfluence,

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

Version 2, edited 7 years ago by fervillz (previous) (next) (diff)

#3 @subrataemfluence
7 years ago

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

Note: See TracTickets for help on using tickets.