WordPress.org

Forums

[resolved] Moving wp-content Folder versus Order of WP Script Loading (2 posts)

  1. JustAnotherWPUsername
    Member
    Posted 4 years ago #

    I've been trying to move the wp-content folder out of the main WP folder.

    I've p a i n s t a k i n g l y followed all of the instructions here:

    http://codex.wordpress.org/Editing_wp-config.php

    I'm testing with a completely fresh, unaltered, unconfigured WP 2.9.2 with no plug-ins. I've tried with MAMP, and on a hosted (FreeBSD/Apache) server at a very reputable host that fully supports WP.

    No matter what I do, WP just completely ignores the WP_CONTENT_DIR and WP_CONTENT_URL define commands in wp-config.

    (I'm not doing anything wrong with my paths -- because the old location of wp-content continues to work -- and testing with a PHP echo of WP_CONTENT_DIR shows that the original path is remaining unaltered.)

    But all this actually makes sense -- because my further testing shows that wp-settings.php (which defines WP_CONTENT_DIR and WP_CONTENT_URL) is running prior to wp-config.php as each WP page is rendered.

    In PHP, a constant (like WP_CONTENT_DIR and WP_CONTENT_URL) cannot be changed during script run. So it is impossible for a define command in wp-config.php to alter WP_CONTENT_DIR and WP_CONTENT_URL if they have been already been defined in wp-settings.php.

    So... do I have a special version of WP, and the code runs in the right order for everyone else?

  2. JustAnotherWPUsername
    Member
    Posted 4 years ago #

    This is all completely wrong -- I was confused.

    The define commands need to be put in wp-config.php above the call to wp-settings.php which is at the bottom of wp-config.php.

    Rather obviously now that it's obvious to me.

    The code is executing in the correct order -- I also had my test echo below the call to wp-settings.php on the wp-config page.

Topic Closed

This topic has been closed to new replies.

About this Topic