renaming/ moving wp-content (9 posts)

  1. Lee Rickler
    Posted 6 years ago #

    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.

  2. whooami
    Posted 6 years ago #

    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.

  3. Lee Rickler
    Posted 6 years ago #

    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!)

  4. 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','http://example.com/full/path/to/your/content/dirs/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).

  5. Lee Rickler
    Posted 6 years ago #

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

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

  7. bellieni
    Posted 6 years ago #

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

  8. designermonkey
    Posted 6 years ago #

    I think the misunderstanding here is that

    define ('WP_CONTENT_DIR','/full/path/to/your/content/dir');
    define ('WP_CONTENT_URL','http://example.com/full/path/to/your/content/dirs/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.

  9. MichaelH
    Posted 5 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic