WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#31361 closed defect (bug) (invalid)

WP_SITEURL and WP_HOME breaks the admin bar and disables styles in the login page

Reported by: gemjeweled Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Administration Keywords: reporter-feedback
Focuses: administration Cc:
PR Number:

Description

Steps to reproduce:

  1. add the following lines in wp-config.php just above the line /* That's all, stop editing! Happy blogging. */:
    define( 'WP_SITEURL', 'http://sample.wordpress.org' );
    define( 'WP_HOME', 'http://sample.wordpress.org' );
    
  1. refresh the front end and check via Network in Chrome Developer Tools. dashicons.min.css, admin-bar.min.css and admin.bar.min.js are not loaded. Even the two jQuery files have loading problems as well.

http://i.imgur.com/ujgM34I.jpg

  1. On view source of the page, the incorrect URLs can be seen (that is, those that start with http://www.... with the slug of the page attached). The slug of the posts are appended as well, which is not desired.

http://i.imgur.com/zi81tHe.jpg

  1. The same problem can also be seen at the login page - only if a query string is appended to the URL. The stylesheets and scripts do not load properly because the query string is passed along to the stylesheet and script urls. The login page looks fine if there is no query string.

http://i.imgur.com/z9aBiX3.jpg

  1. Same problem still exists even if all plugins are disabled, theme is switched to the default theme (Twenty Fifteen, etc) and even with a clean/reinstalled copy of WordPress.
  1. Even if the the site and home URL indicated in the database is equal to that of the WP_SITEURL and WP_HOME respectively (that is, http://sample.wordpress.org is also indicated in the database), the same problem still persists. In other words, as long as WP_SITEURL and WP_HOME is specified in wp-config.php, this problem occurs.
  1. Remove/uncomment the two WP_HOME and WP_SITEURL lines above and everything works as expected.

The only resolution is to avoid the use of both constants and simply change the values onto the database.

Change History (2)

#1 @SergeyBiryukov
5 years ago

  • Focuses ui template removed
  • Keywords reporter-feedback added

Same problem still exists even if all plugins are disabled, theme is switched to the default theme (Twenty Fifteen, etc) and even with a clean/reinstalled copy of WordPress.

Could not reproduce on a clean install, WP_HOME and WP_SITEURL work as expected for me.

Looking at the screenshots, you have some paths prepended with the current page URL, as well as some root-relative paths. None of this should happen on a clean install, WordPress uses absolute URLs by default.

  1. What were the actual WP_HOME and WP_SITEURL values you have set?
  2. Do you have something on your install that turns absolute URLs to relative?

#2 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.