Changing WP_CONTENT_DIR and WP_CONTENT_URL in wp-config.php does not register?

The question:

I tried to add this to the end of my wp-config.php

define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/somedir');
define('WP_CONTENT_URL', '');

however, echo immediately after that shows the old values (with wp-content value). I tried echo because in wp admin I couldn’t see the theme from new location, of course.

I have installed wp in subdirectory and site itself is – I copied over .htaccess and index.php over to the root and everything is working fine, I just need to move wp-content into another folder over at root also with a different name.

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

You have probably added the definitions too late. If in fact you added that “to the end” of wp-config.php then you added it after these lines:

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

If so, then those constants are already defined (wp_initial_constants) and you cannot redefine a constant after it is already defined.

Make your edits earlier, before:

/* That's all, stop editing! Happy blogging. */

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment