Skip to content

Instantly share code, notes, and snippets.

@sitemapxml
Last active July 22, 2023 13:10
Show Gist options
  • Save sitemapxml/32f34c06b34e0ff72bc49ba5294265aa to your computer and use it in GitHub Desktop.
Save sitemapxml/32f34c06b34e0ff72bc49ba5294265aa to your computer and use it in GitHub Desktop.
Wordpress wp-config.php Template With Custom Directory Structure #wordpress #custom #config
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
// Debug log settings
define( 'WP_DEBUG_LOG', false );
// Error reporting settings
define('WP_DEBUG_DISPLAY', false);
//ini_set('display_errors','Off');
//ini_set('error_reporting', E_ALL );
// Disable WP CRON
// If you have high resource usage on server you can disable WP CRON to lower CPU and RAM usage
define('DISABLE_WP_CRON', true);
// Automatic updates are recomended because of security, but somethimes they can have the opposite
// effect. If you want to manually update Wordpress core you can disable Auto Update feature
define( 'WP_AUTO_UPDATE_CORE', false );
// Change cookie names
// https://wordpress.stackexchange.com/a/202019
define( 'COOKIEHASH', md5( 'http://example.tld' ) );
define( 'USER_COOKIE', 'custom_user_' . COOKIEHASH );
define( 'PASS_COOKIE', 'custom_pass_' . COOKIEHASH );
define( 'AUTH_COOKIE', 'custom_' . COOKIEHASH );
define( 'SECURE_AUTH_COOKIE', 'custom_sec_' . COOKIEHASH );
define( 'TEST_COOKIE', 'custom_test_cookie' );
// If you are using Wordfence, it is reccomended to leave LOGGED_IN_COOKIE default name
// If you are change it while using Wordfence, you can experience unexpected issues like
// widget dissapearing from dashboard
define( 'LOGGED_IN_COOKIE', 'custom_logged_in_' . COOKIEHASH );
// Disable post revisions and increase autosave interval to lower server resource usage
define('AUTOSAVE_INTERVAL', 120 ); // time in seconds
define('WP_POST_REVISIONS', false );
// Multisite settings
// This is just example of subdirectory multisite setup
// You should paste this directives from Wordpress admin dashboard in the section "Tools -> Network Setup"
//define( 'WP_ALLOW_MULTISITE', true );
//define('MULTISITE', true);
//define('SUBDOMAIN_INSTALL', false);
//define('DOMAIN_CURRENT_SITE', 'example.com');
//define('PATH_CURRENT_SITE', '/');
//define('SITE_ID_CURRENT_SITE', 1);
//define('BLOG_ID_CURRENT_SITE', 1);
// Multisite default theme
// This is the theme that will be set by default when creating new sub-site
//define( 'WP_DEFAULT_THEME', 'your-favourite-theme' );
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
// Change wp-content folder name
define ('WP_CONTENT_FOLDERNAME', 'content');
// New directory path
define ('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME);
// New content directory path
define('WP_SITEURL','https://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_CONTENT_URL', 'https://example.com/content');
// Upload folder relative path
// If you want to move upload folder to the web root
// you can just use 'uploads', or 'media' or whatever name you like
define('UPLOADS', 'content/uploads');
// Plugin folder path
// If you have moved wp-config.php above webroot than you should specify path from
// the wp-config.php location as the starting point.
// It is highly reccomended to move wp-config.php above webroot.
// More info at: https://wordpress.stackexchange.com/q/58391
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/rename-this/content/plugins' );
// If wp-config.php is in the webroot than simply add:
// define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/content/plugins' );
// Plugin folder external URL address
define( 'WP_PLUGIN_URL', 'https://example.com/content/plugins' );
// Must Use Plugins folder path and url
// Just like previously described, use wp-config.php location as the starting point.
// Otherwise, delete "/rename-this" slug ftom URL address
define( 'WPMU_PLUGIN_DIR', dirname(__FILE__) . '/rename-this/content/mu-plugins' );
define( 'WPMU_PLUGIN_URL', 'https://example.com/content/mu-plugins' );
/** 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