Mar 31, 2013
Tip and Trick Editorial

How to Move or Rename WordPress wp-content Directory

By default, WordPress assigns wp-content directory as the default user content folder, where all plugins are stored in wp-content/plugins, all themes are stored in wp-content/themes and all uploads are uploaded saved in wp-content/uploads. However, WordPress does allow users to relocate and change the wp-content directory to anywhere you want, and rename the wp-content to any name you prefer.

To set a custom content and plugins directories for WordPress, edit the wp-config.php, and append the following 4 lines of constants which tell WordPress the path to the content and plugin directories:

/** Set the location of content directory */
define('WP_CONTENT_DIR', '/path/to/custom/wp-content');
define('WP_CONTENT_URL', 'url/to/custom/wp-content');

/** Set the location of plugins directory */
define( 'WP_PLUGIN_DIR', '/path/to/custom/plugins' );
define( 'WP_PLUGIN_URL', 'url/to/custom/plugins' );

For example:

define( 'WP_CONTENT_DIR', '/home/tipandtrick/public_html/user_content' );
define( 'WP_CONTENT_URL', '' );

define( 'WP_PLUGIN_DIR', '/home/tipandtrick/public_html/plugins' );
define( 'WP_PLUGIN_URL', '' );

The WP_CONTENT_DIR and WP_PLUGIN_DIR constants are used to specify the actual filesystem path to content and plugin directory, which can be different name from ‘wp-content. Note that the locations must be accessible by the web server process, so theoretically the locations must be within the web document root or home directory of the domain name. It’s possible to use the $_SERVER[‘DOCUMENT_ROOT’] and $_SERVER[‘SERVER_NAME’] global variables to construct a path relative to the document root. For example:

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

The WP_CONTENT_URL and WP_PLUGIN_URL definitions specifies the full base URI to the custom directories (without trailing slash) from which resources in the content and plugins directories may be accessed.

[box title=”Tip” color=”#0000FF”]It’s possible to remove wp-content completely, by specifying the content directory to be the document root itself. For example:

define( 'WP_CONTENT_DIR', '/home/tipandtrick/public_html' );
define( 'WP_CONTENT_URL', '' );

define( 'WP_PLUGIN_DIR', '/home/tipandtrick/public_html/plugins' );
define( 'WP_PLUGIN_URL', '' );

In this case, all the themes, plugins and uploads directories will appear right after the domain root, i.e.,, and etc.[/box]

With WP_PLUGIN_DIR and WP_PLUGIN_URL, users can rename the plugins directory, such as to just ‘p’ or ‘addons’. As the plugins directory can be configured separately from content directory, so you can make it resides outside of content directory, or continue to reside inside wp-content. But since you’re changing the wp-content to something else, there’s no point to let plugins directory to stay inside wp-content directory. And if you’re to maintain the directory structure of WordPress, plugins directory should go inside content directory.

After changing the content directory, users may also want to change the path to content directory and/or name of ‘Uploads’ folder which used by WordPress to store media files that are been uploaded. To do so, go to Settings -> Media. Under Uploading Files section, amend the values for Store uploads in this folder and Full URL path to files accordingly.

WordPress Uploads Path and URL

[box title=”Tip” color=”#0000FF”]If you do not see the options to change the default media uploads path, follow these steps to reveal the media uploads path options.[/box]

If you’re changing the path and/or name of wp-content folder on an existing website, it’s important to move the existing themes, plugins, and uplaods (if the names of latter two was not changed) to the appropriate path to ensure that WordPress continues to work properly. In addition, all the URLs that point to images, videos, medias, and other files have to be updated to reflect the new path. The changes do not limit to just content within posts and pages, but also options that may be saved by themes or plugins.

WordPress does not provide a direct way to rename or change the location of themes folder. However, WordPress provides a function named register_theme_directory() that allows users to register a directory that contains themes, as an extra themes directory.

To register an extra themes folder, create a new plugin named ‘Extra Themes’ (or any name you like) with the following PHP code, then upload it to plugin directory and activate the plugin:

Plugin Name: Extra Themes
Plugin URI:
Description: Register a directory that contains themes.
Version: 1
Author: Tip and Trick
Author URI:


Remember to replace the value for themes directory with either the full filesystem path to a theme folder, or a folder within WP_CONTENT_DIR, or a folder within WP_PLUGIN_DIR.

If you’re putting the additional themes folder inside the content directory or pluging directory, it’s possible to use the constants to construct the themes folder relatively. For example,

register_theme_directory(WP_CONTENT_DIR . '/themes');

Last but not least, some plugins and themes may not be updated to have the awareness that the wp-content directory may be changed to custom path, and hence do not handle the custom relocated path properly, breaking the website. This is especially true if the plugins or themes do not use the WordPress built-in functions to determine where a given file or directory is.

In such case, try to use the mod_rewrite module of Apache or other web server to maintain the compatibility with old and yet-to-updated plugins and themes. The mod_rewrite should rewrite all requests that point to old wp-content directory to the new location. For example, in the .htaccess file, add in the following code and restart Apache:

RewriteRule (.*)(wp-content)(.*) $1content$3 [NC,R,L]


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/wp-content(/*)
RewriteRule ^wp-content/(.*)$ /content/$1 [L, NC]

In the example above, the mod_rewrite is redirecting all requests to /wp-content to /content directory, i.e. a request to load /wp-content/plugins/example/plugin.php would be redirected to load /content/plugins/example/plugin.php. Do note that above rewrite condition and rule are just an example of workaround, and may not work properly in your environment. You need to modify it according to your server configuration. Furthermore, it’ll probably failed to work if the plugins or themes use hard-coded URL to load PHP files.

Pin It on Pinterest

Share This

Share This

Share this post with your friends!