Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#56235 closed enhancement (fixed)

Use a variable for home URL on Permalink Settings screen

Reported by: sabernhardt's profile sabernhardt Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Permalinks Keywords: has-patch
Focuses: administration Cc:

Description

As noted on #56110, I think replacing several instances of get_option( 'home' ) with a variable could improve the code.

It could also use the home_url() function, with escaping.

$url_base = esc_url( home_url() );

Attachments (2)

56235.diff (4.4 KB) - added by sabernhardt 2 years ago.
56235.2.diff (681 bytes) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (5)

@sabernhardt
2 years ago

#1 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.1

I ended up refactoring the whole file in [53710] / #55647 and only saw this ticket after committing. Sorry for that!

We could still use this ticket to replace get_option( 'home' ) with home_url().

#2 @SergeyBiryukov
2 years ago

It looks like esc_url() might not be needed here, as the value is not used in an href or src tag. However, home_url() does appear to be a more common way of retrieving the home URL across the admin.

#3 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 53712:

Permalinks: Use home_url() to set the URL base on Permalink Settings screen.

This brings more consistency with how the home URL is retrieved elsewhere in the admin.

Follow-up to [1567], [1664], [2746], [3029], [4144], [53710].

Props sabernhardt.
Fixes #56235.

Note: See TracTickets for help on using tickets.