Support » Fixing WordPress » renaming/ moving wp-content

  • I see this has been asked a few times with, as far as I can see, only 2 credible replies.
    Neither of these work for me so … my question:
    Is it possible to either move or rename the wp-content folder?

    yes I know that upgrades/ plugins etc could possibly use wp-content but I have set something up that will not be changed for at least 6 months.

    Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Sure, look inside wp-settings.php; make the necessary chaanges.

    If you have already done that, explain what settings you changed (there is more than one), and what the result was, please.

    Thanks for that.

    I simply renamed the wp-content folder and made appropriate changes in wp-settings. Worked perfect!

    oh … and does this also apply to wp-admin as well?

    (apologise for the questions but hopefully this will finally sort this once and for all!)

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Actually, with 2.7 (maybe in 2.6, not sure), you can move the folder and then make two additions to your wp-config.php:

    define ('WP_CONTENT_DIR','/full/path/to/your/content/dir');
    define ('WP_CONTENT_URL','');

    Both must be defined and correct.

    You’ll also want to look through your database for the URL to see if it’s stored anywhere (images inside posts, etc).

    Otto, I tried that before with no success.
    Whooami’s solution works perfect, for me anyway.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I know for a fact that this works with 2.7. Works perfectly for me.

    Not works with my 271, otto!
    I don’t understand!

    I think the misunderstanding here is that

    define ('WP_CONTENT_DIR','/full/path/to/your/content/dir');
    define ('WP_CONTENT_URL','');

    need to be defined in wp-settings.php not wp-config.php. The reason being is that the paths are defined already in wp-settings.php which is called into wp-config.php, meaning that the paths would be overwritten by the original settings.

    To make this work, you need to scan through wp-settings.php for lines 113 & 356 to make the alterations suggested by Otto42.

    designermonkey – not sure that’s correct. Both those lines of code are preceeded with a check to see if WP_CONTENT_DIR and WP_CONTENT_DIR are already defined so wp-settings would not override the wp-config.php settings.

    if ( !defined('WP_CONTENT_DIR') )
    	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down


    if ( !defined('WP_CONTENT_URL') )
    	define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘renaming/ moving wp-content’ is closed to new replies.