WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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', 'http://example.com/somedir');

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 example.com/wp subdirectory and site itself is example.com - 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.

share|improve this question
slash / before somedir is superfificous (double) in line 1. – Frank N Sep 5 '15 at 15:58
up vote 7 down vote accepted

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. */
share|improve this answer
and it was as simple as that! thanks! :) – Keyframe Jun 23 '13 at 17:16
To add to the correct answer, it's recommended to check, if a constant is already 'not defined' before defining it. – Pothi Jun 25 '13 at 8:30
@Pothi : Yes, generally a good idea, but if you define the constants where the WordPress Core intends there should be no problem. – s_ha_dum Feb 19 '14 at 14:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.