Skip to content

Instantly share code, notes, and snippets.

@ozws
Last active January 10, 2021 22:05
Show Gist options
  • Save ozws/723fdf5a83303eca5db7d86a44be0c34 to your computer and use it in GitHub Desktop.
Save ozws/723fdf5a83303eca5db7d86a44be0c34 to your computer and use it in GitHub Desktop.
Oz wp-config
<?php
/*
Additional notes for this gist:
- You'll see that half of the constants are commented out. Nice to
have them there when needed.
- Using a non-standard WP directory structure.
- See BuB note below. Possible items to change during migration:
- $table_prefix
- $dbname, $dbuser, $dbpass
*/
//// Oz START
//// Variables
$preg_match = '/\.code|\.dev|\.devv|\.local|\.old/i';// localhost TLDs
$oz_exthosts = 'api.wordpress.org,akismet.com'; //
//// Check the server
$is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
$protocol = $is_https ? 'https://' : 'http://';
$domain = $_SERVER['HTTP_HOST'];
function is_local_dev() {
foreach ( ['.ozdev','.devv','.local','.old','.code'] as $find )
if ( strpos( $_SERVER['HTTP_HOST'] , $find ) )
return true;
return false;
}
define( 'OZ_DOMAIN', $domain );
$oz_subdir = '';// If WP is in a subdirectory; with leading slash
$ozws_live = 0; //
$table_prefix = 'base_';//
// if/else statement allows same file to be used for both live and local/dev
if ( is_local_dev() ) {
//// localhost
$dbname = '';
$dbuser = '';
$dbpass = '';
$dbhost = 'localhost';
} else {
//// LIVE
$dbname = '';
$dbuser = '';
$dbpass = '';
$dbhost = 'localhost';
$ozws_live = 1;
}
define( 'WP_HOME' , $protocol.$domain );// append '.$oz_subdir' if needed
define( 'WP_SITEURL', $protocol.$domain );// append '.$oz_subdir' if needed
// BuB will complain that it can't find the strings to
// replace during migration etc, but that's OK. Values
// are being set in if/else above.
define( 'DB_NAME' , $dbname );
define( 'DB_USER' , $dbuser );
define( 'DB_PASSWORD', $dbpass );
define( 'DB_HOST' , $dbhost );
define( 'DB_CHARSET' , 'utf8mb4' );// See discussion at https://stackoverflow.com/questions/30074492/what-is-the-difference-between-utf8mb4-and-utf8-charsets-in-mysql
define( 'DB_COLLATE' , '' );
//// Content dir
define( 'DS' , DIRECTORY_SEPARATOR );//
define( 'OZ_CONTENT_DIR', 'assets' );//
define( 'WP_CONTENT_DIR', ABSPATH .OZ_CONTENT_DIR );// path-to-site-root/assets/
define( 'WP_CONTENT_URL', WP_SITEURL.'/'.OZ_CONTENT_DIR );// base.dev/assets/
define( 'WP_PLUGIN_DIR' , WP_CONTENT_DIR.DS.'plugins' );// path-to-site-root/assets/plugins/
define( 'WP_PLUGIN_URL' , WP_CONTENT_URL.'/'.'plugins' );// base.dev/assets/plugins/
define( 'UPLOADS' , OZ_CONTENT_DIR.DS.'files' );// path-to-site-root/assets/files/
// define( 'WP_DEFAULT_THEME','default-theme-folder-name' );//
//// Security
// define( 'FORCE_SSL_LOGIN' , true );// Force SSL for Login Page
// define( 'FORCE_SSL_ADMIN' , true );// Force SSL for Admin
define( 'DISALLOW_FILE_EDIT' , true );// Disable Editor Access
// define( 'WP_ALLOW_REPAIR' , true );// Fix DB, COMMENT IF NOT USING
// define( 'DISALLOW_UNFILTERED_HTML', false );// Disallow unfiltered_html for all users, even admins
// define( 'DISALLOW_FILE_MODS' , true );// Disable Plugin & Theme Update/Install
// define( 'WP_HTTP_BLOCK_EXTERNAL' , true );// Block External Connections
// define( 'WP_ACCESSIBLE_HOSTS' , $oz_exthosts );// Whitelist for External Connections
// define( 'ALLOW_UNFILTERED_UPLOADS', true );// Admins only can upload anything
//// Updates
define( 'WP_AUTO_UPDATE_CORE' , false );// Disable WP core auto updating
define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true );// Just update files we need
// define( 'AUTOMATIC_UPDATER_DISABLED' , true );// Turn off all automatic updates
//// General
define( 'WP_POST_REVISIONS' , 3 );// Limit number of revision stored in DB. Overridden by wp_revisions_to_keep filter.
define( 'AUTOSAVE_INTERVAL' , 300 );// In seconds
define( 'MEDIA_TRASH' , true );// Enable trash for media library
define( 'EMPTY_TRASH_DAYS' , 7 );// Empty trash after __ days
define( 'IMAGE_EDIT_OVERWRITE' , true );// Copies of edited images are overwritten when edited again
// define( 'COOKIE_DOMAIN' , OZ_DOMAIN );// Give browser right cookie
// define( 'WP_MAIL_INTERVAL' , 300 );// In seconds
//// Cron
// define( 'DISABLE_WP_CRON' , false );//
// define( 'ALTERNATE_WP_CRON' , true );// Used for local server, comment for production, unless needed
// define( 'WP_CRON_LOCK_TIMEOUT', 60 );// In seconds
//// Cache / Compression
// define( 'WP_CACHE' , true );// Turn on built-in caching
// define( 'COMPRESS_CSS' , true );//
// define( 'COMPRESS_SCRIPTS' , true );//
// define( 'ENFORCE_GZIP' , true );//
// define( 'PHOTOCRATI_CACHE' , false );// NextGen Gallery, turn gallery caching off
//// Licensing
// define( 'GF_LICENSE_KEY' , '' );// Gravity Forms license key
// define( 'GFORM_DISABLE_AUTO_UPDATE', true );// Gravity Forms Disable auto updates
// define( 'GF_RECAPTCHA_PRIVATE_KEY' , '' );//
// define( 'GF_RECAPTCHA_PUBLIC_KEY' , '' );//
// define( 'ITHEMES_UPDATER_DISABLE' , true );// Disable iThemes updates
// define( 'ITHEMES_SYNC_SKIP_SET_IS_ADMIN_TO_TRUE', true );// See Sync changelog for 1.8.1
// define( 'PB_BACKUPBUDDY_MULTISITE_EXPERIMENT' , true );// Enable BuB multisite support, EXPERIMENTAL
// define( 'ITSEC_DISABLE_PASSWORD_STRENGTH' , true );// See iTSec changelog for 3.0.2
// define( 'ITSEC_DISABLE_PASSWORD_REQUIREMENTS' , true );// See iTSec changelog for 4.0.0
// define( 'ITSEC_DISABLE_MODULES' , true );// See iTSec changelog for 4.1.0
//// Other
// define( 'EDD_SLUG' , 'downloads' );// Set slug for Easy Digital Downloads
// define( 'WP_MEMORY_LIMIT' , '128M' );// Set the server memory limit
// define( 'WP_MAX_MEMORY_LIMIT', '256M' );// Set the server max memory limit, default 256M
if ( ! $ozws_live ) {
// define( 'CONCATENATE_SCRIPTS', false );// admin only, tell WP to NOT concatenate scripts
define( 'FS_METHOD' , 'direct' );// Update plugins without ftp login
} else {
define( 'BACKUPBUDDY_API_ENABLE' , true );// Enable BackupBuddy Deployment access
}
//// Keys and Salts
define('AUTH_KEY', '');
define('SECURE_AUTH_KEY', '');
define('LOGGED_IN_KEY', '');
define('NONCE_KEY', '');
define('AUTH_SALT', '');
define('SECURE_AUTH_SALT', '');
define('LOGGED_IN_SALT', '');
define('NONCE_SALT', '');
//// Debugging mode
define( 'WP_DEBUG' , false );//
define( 'SCRIPT_DEBUG' , WP_DEBUG );// Load non-".min" version
define( 'SAVEQUERIES' , WP_DEBUG );// Save db queries to array
// define( 'WP_DEBUG_LOG' , true );// Log everything to /wp-content/debug.log
// define( 'WP_DEBUG_DISPLAY' , true );// Turn off display of error messages on frontend
// define( 'JETPACK_DEV_DEBUG', true );//
// define( 'RELOCATE' , true );// Used to Update Site URLS
//// Oz END
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WP directory. */
if ( !defined( 'ABSPATH' ) )
define( 'ABSPATH', dirname(__FILE__).DS );
/** Sets up 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