Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Created February 24, 2016 11:48
Show Gist options
  • Select an option

  • Save hsleonis/4a1840f4f73c90b01fe5 to your computer and use it in GitHub Desktop.

Select an option

Save hsleonis/4a1840f4f73c90b01fe5 to your computer and use it in GitHub Desktop.
Move The wp-content Folder
<?php
/*
To change the location of the wp-content is quite simple as the location of this folder
can be configured in your wp-config.php file. One thing to note is that you need to add
these new constant variable above the line where WordPress includes the wp-settings.php.
*/
// All you have to do is add a new variable WP_CONTENT_DIR and change the location of your wp-content folder.
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content' );
// To change the location of the wp-content URL there is another variable you can define in the wp-config.
define( 'WP_CONTENT_URL', 'http://www.paulund.co.uk/blog/content/wp-content' );
// Moving Plugin Folder
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content/plugins' );
// The same as the wp-content folder you can change the URL of the plugin folder for the variable WP_PLUGIN_URL.
define( 'WP_PLUGIN_URL', 'http://example/blog/content/wp-content/plugins');
// The problem with doing this for plugins is that there is another variable which can be used by
// some plugin developers...PLUGINDIR. Therefore you need to make sure that you change this too.
define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/content/wp-content/plugins' );
// Add constant variables above this line
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment