Ticket #4003 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: filosofo Assigned to: charleshooper
Priority: low Milestone: 2.2
Component: Administration Version:
Severity: normal Keywords: home siteurl wp-config has-patch
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

patch.diff (2.6 kB) - added by filosofo on 03/20/07 20:55:00.
trunk-4003.diff (4.0 kB) - added by charleshooper on 03/21/07 18:15:14.
Updated version of patch.diff to check WP_SITEURL value during install and also change is_blog_installed to return boolean value

Change History

03/20/07 20:55:00 changed by filosofo

  • attachment patch.diff added.

03/20/07 21:31:43 changed by ryan

1

03/20/07 22:08:26 changed by westi

+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 ;-)

03/20/07 22:30:38 changed by Dickie

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

03/21/07 00:33:54 changed by JeremyVisser

101

03/21/07 11:28:18 changed by Sewar

+1 googol

This will help fixing a lot of bugs.

03/21/07 17:20:44 changed by charleshooper

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

03/21/07 17:39:51 changed by ryan

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.

03/21/07 17:53:25 changed by charleshooper

+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

03/21/07 18:08:35 changed by ryan

Checking WP_SITEURL during install sounds good.

03/21/07 18:15:14 changed by charleshooper

  • attachment trunk-4003.diff added.

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

03/21/07 18:24:17 changed by charleshooper

  • 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 :-/

03/23/07 17:45:43 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

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

03/30/07 22:14:08 changed by Nazgul

  • milestone changed from 2.3 to 2.2.