WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

#52503 closed defect (bug) (duplicate)

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

Reported by: 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
8 months 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.