Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#34071 closed defect (bug) (fixed)

Incorrect site URL in email templates

Reported by: ramay Owned by: 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 http://mysite.com/my_folder/wp-admin, and my site works from http://mysite.com url. In settings page look like that:
WordPress Address (URL) http://mysite.com/my_folder
Site Address (URL) http://mysite.com

But in email notifications my site url is http://mysite.com/my_folder , but must be http://mysite.com

Attachments (1)

34071.patch (1.8 KB) - added by tyxla 6 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
6 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
6 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 6 years ago by ramay (previous) (diff)

#3 @SergeyBiryukov
6 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].

6 years ago

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

#4 @tyxla
6 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 6 years ago by tyxla (previous) (diff)

#5 @johnbillion
6 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.

6 years ago

#7 @tyxla
6 years ago

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

#8 @SergeyBiryukov
6 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.