Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4003 closed enhancement (fixed)

Set 'home' and 'siteurl' options in wp-config.php

Reported by: filosofo's profile filosofo Owned by: charleshooper's profile charleshooper
Milestone: 2.2 Priority: low
Severity: normal Version:
Component: Administration Keywords: home siteurl wp-config has-patch
Focuses: Cc:

Description

I can't tell you how often I end up editing the database just to change the 'siteurl' and 'home' options.

Recently on the hackers list Matt suggested that it might have been a good thing to have put the those options in wp-config.php, and I agree.

My patch allows you to set the constants "WP_HOME" and "WP_SITEURL" in wp-config.php, in which case they will override the db settings (and gray out those fields in the admin options page).

As far as I can tell, this is something that would have to be done with a core change like this, because plugins are read too late after 'home' and 'siteurl' have already been used in wp-settings.php.

Attachments (2)

patch.diff (2.6 KB) - added by filosofo 17 years ago.
trunk-4003.diff (4.0 KB) - added by charleshooper 17 years ago.
Updated version of patch.diff to check WP_SITEURL value during install and also change is_blog_installed to return boolean value

Download all attachments as: .zip

Change History (14)

@filosofo
17 years ago

#2 @westi
17 years ago

+100

This is the most requested feature I have seen when considering using WordPress in a staged environment.

Now we just need the facility (plugin) to fix all the absolute urls in page content that are broken when this is changed ;-)

#3 @Dickie
17 years ago

Agreed, this would be MORE than useful, and is also the subject of at least 2 ideas in the ideas section.

http://wordpress.org/extend/ideas/topic.php?id=70&page&replies=9
http://wordpress.org/extend/ideas/topic.php?id=142&page&replies=4

#5 @Sewar
17 years ago

+1 googol

This will help fixing a lot of bugs.

#6 @charleshooper
17 years ago

+1, should we also update is_blog_installed() to use this new constant?

#7 @ryan
17 years ago

is_blog_installed is more of a DB check. Since we always create a siteurl option during install, I think we can leave it as is. We might want to change it to return true/false so that no one is tempted to use the return value as anything other than a bool.

#8 @charleshooper
17 years ago

+1 for the boolean return, I'll submit the patch here in a few. I did notice that in wp_install() we do a update_option('siteurl', $guessurl), I think it's a good idea to override $guessurl if WP_SITEURL is already definied

#9 @ryan
17 years ago

Checking WP_SITEURL during install sounds good.

@charleshooper
17 years ago

Updated version of patch.diff to check WP_SITEURL value during install and also change is_blog_installed to return boolean value

#10 @charleshooper
17 years ago

  • Owner changed from anonymous to charleshooper
  • Status changed from new to assigned

I've added a new patch, although I'm not sure why I can't preview it :-/

#11 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5093]) Allow siteurl and home to be defined as constants in wp-config, bypassing the DB. Props filosofo and charleshooper. fixes #4003

#12 @Nazgul
17 years ago

  • Milestone changed from 2.3 to 2.2
Note: See TracTickets for help on using tickets.