Skip to content

Instantly share code, notes, and snippets.

@dkrusky
Created December 22, 2018 00:23
Show Gist options
  • Save dkrusky/6fa5d5427c0bd0820fb2e8e913244803 to your computer and use it in GitHub Desktop.
Save dkrusky/6fa5d5427c0bd0820fb2e8e913244803 to your computer and use it in GitHub Desktop.
Better WordPress Config (All customization's available)
<?php
/* Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') ) { define('ABSPATH', dirname(__FILE__) . '/'); }
/* Debug Mode */
error_reporting(E_ALL);
@ini_set('display_errors', false );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', false );
define( 'SAVEQUERIES', false );
/* set variables */
$table_prefix = 'wp_';
$use_ssl = true;
$wp_content_root = 'wp-content';
$wp_content_uploads = "{$wp_content_root}/uploads";
$wp_content_plugins = "{$wp_content_root}/plugins";
$wp_content_plugins_mu = "{$wp_content_root}/plugins";
$use_fsoverride = false;
$use_ftpssh = false;
/* Database */
define( 'DB_NAME', 'wordpress');
define( 'DB_USER', 'root');
define( 'DB_PASSWORD', '');
define( 'DB_HOST', 'localhost');
define( 'DB_CHARSET', 'utf8');
define( 'DB_COLLATE', '');
define( 'CUSTOM_USER_TABLE', $table_prefix.'users' );
define( 'CUSTOM_USER_META_TABLE', $table_prefix.'usermeta' );
/* Server and Paths */
define( 'WP_SITEURL', ($use_ssl ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME', WP_SITEURL);
define( 'UPLOADS', $wp_content_uploads );
define( 'WP_CONTENT_DIR', ABSPATH . "/{$wp_content_root}" );
define( 'WP_CONTENT_URL', WP_SITEURL . "/{$wp_content_root}" );
define( 'WP_PLUGIN_DIR', ABSPATH . "/{$wp_content_plugins}" );
define( 'WP_PLUGIN_URL', WP_SITEURL . "/{$wp_content_plugins}" );
define( 'WPMU_PLUGIN_DIR', ABSPATH . "/{$wp_content_plugins_mu}" );
define( 'WPMU_PLUGIN_URL', WP_SITEURL . "/{$wp_content_plugins_mu}" );
/* Cookies */
define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', WP_HOME . '/' ) );
define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', WP_SITEURL . '/' ) );
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
/* Restrict External Access */
define( 'WP_HTTP_BLOCK_EXTERNAL', true );
define( 'WP_ACCESSIBLE_HOSTS', "{$_SERVER['HTTP_HOST']},*.{$_SERVER['HTTP_HOST']}" );
/* Cache */
define( 'WP_CACHE', false );
define( 'WP_CACHE_KEY_SALT', 'salt2018' );
/* Languages */
//define( 'WPLANG', 'en_CA' );
//define( 'WP_LANG_DIR', ABSPATH . '/lang' );
/* Options */
define( 'DISABLE_WP_CRON', true );
define( 'ALTERNATE_WP_CRON', false );
define( 'WP_CRON_LOCK_TIMEOUT', 3600 );
define( 'WP_POST_REVISIONS', 2 );
define( 'DISALLOW_FILE_EDIT', true );
define( 'DISALLOW_FILE_MODS', true );
define( 'EMPTY_TRASH_DAYS', 0 );
define( 'WP_MEMORY_LIMIT', '96M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
define( 'WP_ALLOW_MULTISITE', false );
define( 'AUTOSAVE_INTERVAL', 600 );
define( 'NOBLOGREDIRECT', WP_HOME );
define( 'CONCATENATE_SCRIPTS', true );
define( 'DISALLOW_UNFILTERED_HTML', true );
define( 'IMAGE_EDIT_OVERWRITE', true );
define( 'FORCE_SSL_ADMIN', $use_ssl );
define( 'WP_ALLOW_REPAIR', true );
define( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'WP_AUTO_UPDATE_CORE', false );
/* Override File/Dir Permissions */
if( $use_fsoverride ) {
define( 'FS_CHMOD_DIR', ( 0515 & ~ umask() ) );
define( 'FS_CHMOD_FILE', ( 0404 & ~ umask() ) );
}
/* FTP/SSH OPTIONS */
if( $use_ftpssh ) {
// direct, ssh2, ftpext, ftpsockets
define( 'FS_METHOD', 'ssh2' );
define( 'FTP_SSL', true );
// hostname:port combo for your SSH/FTP server
define( 'FTP_HOST', '' );
// absolute path to root installation directory
define( 'FTP_BASE', ABSPATH );
define( 'FTP_CONTENT_DIR', WP_CONTENT_DIR );
define( 'FTP_PLUGIN_DIR ', WP_PLUGIN_DIR );
// absolute path to your SSH public key
define( 'FTP_PUBKEY', '../.ssh/id_rsa.pub' );
define( 'FTP_PRIKEY', '../.ssh/id_rsa' );
// either your FTP or SSH username
define( 'FTP_USER', '' );
define( 'FTP_PASS', '' );
}
/* 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