Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#52503 closed defect (bug) (duplicate)

remove_query_arg() can create a url such as `/?#anchor` instead of `/#anchor`

Reported by: dd32's profile dd32 Owned by:
Milestone: Priority: lowest
Severity: trivial Version:
Component: General Keywords: needs-patch good-first-bug
Focuses: Cc:

Description

When running remove_query_arg(), the output of the query vars differs based on if an anchor tag is included.

For example:

wp> remove_query_arg( 'foo', 'https://example.org/?foo=bar#baz' );
string(25) "https://example.org/?#baz"

wp> remove_query_arg( 'foo', 'https://example.org/?foo=bar' );
string(20) "https://example.org/"

In the first example, the ? should not be included.

Change History (1)

#1 @sabernhardt
4 years ago

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

#44499 covers removing the ?, within the add_query_arg function.

Note: See TracTickets for help on using tickets.