Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#34071 closed defect (bug) (fixed)

Incorrect site URL in email templates

Reported by: ramay's profile ramay Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.3
Component: Users Keywords: has-patch
Focuses: Cc:


I've installed wordpress press in another directory and my url to admin page become, and my site works from url. In settings page look like that:
WordPress Address (URL)
Site Address (URL)

But in email notifications my site url is , but must be

Attachments (1)

34071.patch (1.8 KB) - added by tyxla 9 years ago.
Use home_url() for the site URL in the wp_update_user() email notifications.

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
9 years ago

  • Focuses administration template performance removed
  • Keywords reporter-feedback added
  • Summary changed from Email template to Incorrect site URL in email templates

Hi @ramay, welcome to Trac!

Could you clarify which email notifications in particular have the incorrect URL?

Does the issue still happen with all plugins disabled and a default theme (Twenty Fifteen) activated?

#2 @ramay
9 years ago

Replying to SergeyBiryukov:
Yes it's still happen in native wordpress email template (Password Change Notification) at the bottom of email:

All at «My site name»

It seems that function instead of home_url returns site_url

Last edited 9 years ago by ramay (previous) (diff)

#3 @SergeyBiryukov
9 years ago

  • Component changed from Mail to Users
  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 4.4
  • Version changed from 4.3.1 to 4.3

So, there are 4 instances of that template:

The first two use network_home_url() and appear to be unaffected.

The second two use get_option( 'siteurl' ) and should probably use home_url() instead.

Introduced in [32820].

9 years ago

Use home_url() for the site URL in the wp_update_user() email notifications.

#4 @tyxla
9 years ago

  • Keywords has-patch added; needs-patch removed
  • Status changed from new to closed

The above patch fixes this issue as @SergeyBiryukov suggested. This addresses the wrong site URL in the user update email notifications in the cases when there is a difference between the site URL (the WordPress Address (URL) option) and home URL (the Site Address (URL) option).

Side note: There are several more occurences of get_option( 'siteurl' ) that might need to be updated to use home_url() as well. IMHO they are worth the investigation.

Last edited 9 years ago by tyxla (previous) (diff)

#5 @johnbillion
9 years ago

  • Status changed from closed to reopened

@tyxla a ticket is only closed once it's been committed to core. :)

This ticket was mentioned in Slack in #core by johnbillion. View the logs.

9 years ago

#7 @tyxla
9 years ago

Oh, I must have accidentally closed it - sorry about that. I didn't even notice - thanks!

#8 @SergeyBiryukov
9 years ago

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

In 34820:

Use home_url() instead of get_option( 'siteurl' ) in notifications that are sent when a user's email address or password is changed.

Props tyxla, ramay.
Fixes #34071.

Note: See TracTickets for help on using tickets.