Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
Last active January 5, 2018 14:28
Show Gist options
  • Save shirokoweb/5119a497e8a691de4236a21397f52725 to your computer and use it in GitHub Desktop.
Save shirokoweb/5119a497e8a691de4236a21397f52725 to your computer and use it in GitHub Desktop.
Setup custom path to wp-content folder in wp-config.php
$scheme = 'http';
// detect if we use HTTPS protocole
if ( isset( $_SERVER['HTTP_USER_AGENT_HTTPS'] ) && $_SERVER['HTTP_USER_AGENT_HTTPS'] == 'ON' ) {
$scheme = 'https';
}
// replace with subdomain name for static files
$static_folder_name = 'static';
// replace if you change default name
$wp_content_folder_name = 'wp-content';
$site_url = $scheme . '://' . $_SERVER['HTTP_HOST'] . '/';
$content_url = $scheme . '://' . $static_folder_name . '.' . $_SERVER['HTTP_HOST'] . '/' . $wp_content_folder_name;
define( 'WP_HOME', $site_url );
define( 'WP_SITEURL', $site_url );
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/' . $static_folder_name . '/' . $wp_content_folder_name );
define( 'WP_CONTENT_URL', $content_url );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment