Make WordPress Core

Opened 3 years ago

Last modified 2 months ago

#44499 new defect (bug)

add_query_arg function doesn't remove the empty '?' when an anchor exists

Reported by: benjamin.anakena Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 4.9.6
Component: General Keywords: has-patch needs-testing
Focuses: Cc:


To reproduce:

$url = 'https://domain.com/uri?param=value#anchor';
$url = add_query_arg( 'param', false, $url );
echo $url;

Expected value: https://domain.com/uri#anchor
Returned value: https://domain.com/uri?#anchor

Attachments (1)

44499.patch (414 bytes) - added by sabernhardt 5 months ago.
replace ?# with #

Download all attachments as: .zip

Change History (3)

5 months ago

replace ?# with #

#1 @sabernhardt
5 months ago

  • Keywords has-patch needs-testing added

@benjaminanakena Thanks for the report!

44499.patch works with the example.

#2 @sabernhardt
2 months ago

#52503 was marked as a duplicate.

Note: See TracTickets for help on using tickets.