[wp-hackers] Moving wp-settings.php out of wp-config.php

Sean Hickey seanhickey at gmail.com
Sun Aug 20 13:21:10 GMT 2006


Howdy all,
I'm not sure if this has been brought up before, but does anything
think it's not a good idea that the wp-config.php script contains
require_once(ABSPATH.'wp-settings.php');?

I've got two problems with this:

1. It's just bad form.  The wp-config.php is designed to hold
configuration information.  It shouldn't do anymore, or any less.

2. It makes it impossible to include the wp-config.php script -- to
get the DB info -- without loading everything else.

The fix is simply adding the line
require_once(ABSPATH.'wp-settings.php'); below the require_once(
dirname(__FILE__) . '/wp-config.php'); in the wp-blog-header.php
script.  Then the wp-config.php can act exactly as it should -- as the
script that holds the DB connection information.

Not wanting to break any existing plugins, the wp-config.php script
could check for a defined constant, and if that constant is TRUE, it
skips the inclusion of the wp-settings.php.  That way all old plugins
still work, but new plugins can use wp-config.php the way it was meant
to be used.  I could do something like:

define('CONFIG_NOLOAD', true);
include('wp-config.php');

- Sean
-- 
http://www.headzoo.com


More information about the wp-hackers mailing list