Last active
April 13, 2025 08:51
-
Star
(193)
You must be signed in to star a gist -
Fork
(58)
You must be signed in to fork a gist
-
-
Save MikeNGarrett/e20d77ca8ba4ae62adf5 to your computer and use it in GitHub Desktop.
All those damned wp-config constants you can never remember.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PHP memory limit for this site | |
define( 'WP_MEMORY_LIMIT', '128M' ); | |
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit. | |
// Database | |
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database. | |
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users) | |
// Explicitely setting url | |
define( 'WP_HOME', 'http://domain.com' ); | |
define( 'WP_SITEURL', 'http://domain.com' ); | |
// Set url to... whatever. | |
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] ); | |
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] ); | |
// Set default theme | |
define( 'WP_DEFAULT_THEME', 'twentytwentyone' ); | |
// Temporary for causing a site to relocate. Remove after login. | |
define( 'RELOCATE', true ); | |
// Allow WordPress to update files | |
define( 'FS_METHOD', 'direct' ); | |
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); // change permissions of directories | |
define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) ); // change permissions of files | |
// Set the directory files should be downloaded to before they're moved. | |
// This is usually set in the PHP conf | |
define( 'WP_TEMP_DIR', '/Applications/MAMP/tmp/php/' ); // this one is for default MAMP setup | |
// Content, plugin, and template paths | |
define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); // Full URL to wp-content | |
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // No trailing slash, full paths only to wp-content | |
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash. | |
define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // Full URL, no trailing slash. | |
define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. | |
define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash. | |
define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // Full URL, no trailing slash. | |
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. | |
define( 'TEMPLATEPATH', get_template_directory() ); | |
define( 'STYLESHEETPATH', get_stylesheet_directory() ); | |
// Set post revisions to something feasible | |
define( 'WP_POST_REVISIONS', 15 ); | |
// Autosave interval of post revisions in seconds. | |
define( 'AUTOSAVE_INTERVAL', 160 ); // Seconds | |
// Set cookie domain for login cookies | |
// Very helpful if you're getting cookie errors during login | |
define( 'COOKIE_DOMAIN', '.domain.com' ); // Domain and all subdomains | |
define( 'COOKIE_DOMAIN', 'domain.com' ); // only root domain | |
define( 'COOKIE_DOMAIN', 'www.domain.com' ); // only subdomain | |
// More cookie constants | |
define( 'COOKIEPATH', $_SERVER['HTTP_HOST'] . '/' ); // You should set this explicitely. | |
define( 'SITECOOKIEPATH', $_SERVER['HTTP_HOST'] . '/' ); // You should set this explicitely. | |
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); | |
define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) ); | |
// Cookie names. | |
define( 'USER_COOKIE', 'wordpressuser_' . COOKIEHASH ); | |
define( 'PASS_COOKIE', 'wordpresspass_' . COOKIEHASH ); | |
define( 'AUTH_COOKIE', 'wordpress_' . COOKIEHASH ); | |
define( 'SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH ); | |
define( 'LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH ); | |
define( 'RECOVERY_MODE_COOKIE', 'wordpress_rec_' . COOKIEHASH ); | |
// WordPress debug on and off | |
define( 'WP_DEBUG', true ); | |
define( 'WP_DEBUG_LOG', true ); | |
define( 'WP_DEBUG_DISPLAY', true ); | |
define( 'WP_LOCAL_DEV', true ); // Magic switch for local dev | |
// Script and style debug | |
define( 'CONCATENATE_SCRIPTS', false ); // Causes WordPress scripts to be included separately | |
define( 'SCRIPT_DEBUG', true ); // Uses unminified scripts | |
define( 'SAVEQUERIES', true ); // Requires analyzing the global $wpdb object. | |
define( 'COMPRESS_SCRIPTS', true ); | |
define( 'COMPRESS_CSS', true ); | |
define( 'ENFORCE_GZIP', true ); | |
// Disable WP cron in favor of server cron | |
define( 'DISABLE_WP_CRON', true ); | |
define( 'ALTERNATE_WP_CRON', true ); // alternate method of firing cron in the background when initiated by end users. | |
define( 'WP_CRON_LOCK_TIMEOUT', MINUTE_IN_SECONDS ); // limit cron runs to a certain interval. | |
// SSL | |
define( 'FORCE_SSL_LOGIN', true ); // Only secrue the registration/login process | |
define( 'FORCE_SSL_ADMIN', true ); // Force SSL for the whole WordPress admin | |
// The "timthumb" fix | |
define( 'WP_HTTP_BLOCK_EXTERNAL', true ); | |
define( 'WP_ACCESSIBLE_HOSTS', 'api.wordpress.org,*.github.com' ); // Only allow particular hosts in | |
// Modifying files | |
define( 'DISALLOW_FILE_EDIT', true ); // Kill the WordPress file editor | |
define( 'DISALLOW_FILE_MODS', true ); // Don't allow users to update core, plugins, or themes | |
define( 'IMAGE_EDIT_OVERWRITE', true ); // Allow editing images to replace the originals | |
// Changing WordPress updates. | |
define( 'AUTOMATIC_UPDATER_DISABLED', true ); // Disable all WordPress auto-updates | |
define( 'WP_AUTO_UPDATE_CORE', false ); // Only disable core updates | |
define( 'WP_AUTO_UPDATE_CORE', 'minor' ); // Only enable minor core updates | |
// Change languages | |
define( 'WPLANG', 'de_DE' ); | |
define( 'WP_LANG_DIR', dirname(__FILE__) . 'wordpress/languages' ); | |
// Trash | |
define( 'EMPTY_TRASH_DAYS', 30 ); // Number of days to wait before emptying the trash | |
define( 'MEDIA_TRASH', false ); // Whether to allow media items to use the trash functionality. | |
// Dev tools | |
define( 'SHORTINIT', false ); // Disable most of WordPress. Useful for fast responses for custom integrations. | |
// https://wordpress.stackexchange.com/questions/12919/what-is-the-constant-wp-use-themes-for | |
define( 'WP_USE_THEMES', true ); // Override if you love WordPress, but hate themes. | |
// Recovery mode and fatal error handling. | |
define( 'WP_SANDBOX_SCRAPING', true ); // Turn off WSOD Protection (and don't send email notification) | |
define( 'WP_START_TIMESTAMP', microtime( true ) ); // Modify the WordPress start time. | |
define( 'RECOVERY_MODE_EMAIL', '[email protected]' ); // Set a recovery mode email. |
define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
define( 'TEMPLATEPATH', get_template_directory() );
define( 'STYLESHEETPATH', get_stylesheet_directory() );
These will cause a fatal error - get_option(), get_template_directory() and get_stylesheet_directory() are not available in wp-config.php.
Hi, my config php
<?php
/* Paths */
define( 'ROOT', preg_replace( '|/+|','/', str_replace( '\\', '/', dirname( dirname(__FILE__) ) ) ) );
define( 'CONFIG_ROOT', ROOT . '/config' );
define( 'WEB_ROOT', ROOT . '/web' );
foreach( array( 'local', 'development', 'staging', 'production' ) as $environment ) {
if ( file_exists( CONFIG_ROOT . '/' . $environment . '-config.php' ) ) {
define( 'WP_ENVIRONMENT_TYPE', $environment );
require CONFIG_ROOT . '/' . $environment . '-config.php';
}
}
define( 'WP_DEVELOPMENT_MODE' , '' ); //'core','plugin', 'theme', 'all', ''
if ( WP_ENVIRONMENT_TYPE === 'local' ) {
define( 'DISALLOW_INDEXING', true );
define( 'WP_POST_REVISIONS', false );
}
/* Default */
define( 'WPLANG', 'cs_CZ' );
define( 'WP_DEFAULT_THEME', 'my-theme' );
define( 'IS_SSL', true );
define( 'RECOVERY_MODE_EMAIL', '[email protected]' );
define( 'WP_DISABLE_ADMIN_EMAIL_VERIFY_SCREEN', false );
/* Database */
$table_prefix = 'wpnsqtsv_';
define( 'WP_ALLOW_REPAIR', true );
//define( 'CUSTOM_USER_TABLE', $table_prefix . ' my_users' );
//define( 'CUSTOM_USER_META_TABLE', $table_prefix . ' my_usermeta' );
/* Security */
/* Security Keys => https://api.wordpress.org/secret-key/1.1/salt/ */
define('AUTH_KEY', 'qM?.&H^=Dx#Wp 9wz bB{}%Pp6yHCYbr30Q+hE~x9%-Ijt590?,/S@SKr{(X8)y7');
define('SECURE_AUTH_KEY', '+?wY]-@!|f~OVjME0*/^zAe^rCGvm{[tYXexoiPP$4JI)V=j$U!DD11:qi?{e#03');
define('LOGGED_IN_KEY', '+x~D6,vW.O;@$] e|ef8Os%kFuu&=?E{V-xUWod>nn}AG|.{p_D~<uUq1Q(y>w.)');
define('NONCE_KEY', 'e]!ggI+.QeJ*hb@znTx[;M//(t~F?{f_Pwvz$VNTY/?8o.(,|yni()33o=N1ru8g');
define('AUTH_SALT', '}/~R+lKPM(j&6vEDQ+d-X[)uOVEyB8Q<Sy|TCY5++=5-gIl4y+2qk]:G[[I-f8h;');
define('SECURE_AUTH_SALT', 'F`/XoYWBSJ>H*}H9z/j*7-+K*~pAkv9=T-qXx,C._h-haOA/>53|2b@;(^>HnqzI');
define('LOGGED_IN_SALT', ']Xd(s7T47g]8cL,LOx-C:T(G+JXoGywzDB0c]ntO! P}v(<$ C)`(Z3 =vK8jY02');
define('NONCE_SALT', '#$gY>]^~O6(/g5Sh&,B)3YofnLv:HHWm+F ERDU-P>l9FjlFBFUy+$xhkd7`wyt=');
/* URL / Path */
define( 'WP_SITEURL', ( IS_SSL ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . '/web/wp' );
define( 'WP_HOME', ( IS_SSL ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] );
define( 'WP_CONTENT_DIR', WEB_ROOT . '/app' );
define( 'WP_CONTENT_URL', ( IS_SSL ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . '/content' );
define( 'WP_LANG_DIR', WEB_ROOT . '/app/languages' );
define( 'WP_PLUGIN_DIR', WEB_ROOT . '/app/plugins' );
define( 'WP_PLUGIN_URL', ( IS_SSL ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . '/modules' );
define( 'WPMU_PLUGIN_DIR', WEB_ROOT . '/app/mu-plugins' );
define( 'WPMU_PLUGIN_URL', ( IS_SSL ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . '/extra-modules' );
//define( 'UPLOADS', 'uploads' );
//define( 'WP_TEMP_DIR', '/tmp/php/' );
/* SSL */
define( 'FORCE_SSL_LOGIN', IS_SSL );
define( 'FORCE_SSL_ADMIN', IS_SSL );
/* Cookies */
define( 'SITECOOKIEPATH', $_SERVER['HTTP_HOST'] . '/' ); // You should set this explicitely.
define( 'COOKIEPATH', $_SERVER['HTTP_HOST'] . '/' ); // You should set this explicitely.
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . '/admin' );
define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
define( 'TEST_COOKIE', WP_DEFAULT_THEME . '_test' );
define( 'COOKIEHASH', 'mwUjIPydjimdxX7lFxbOzuhvI7ZwiirbS2l6tY3bhA5PvN25KGE1RX5CVCv9Uc6Y' );
define( 'LOGGED_IN_COOKIE', WP_DEFAULT_THEME . '_logged_in_' . COOKIEHASH );
define( 'SECURE_AUTH_COOKIE', WP_DEFAULT_THEME . '_sec_' . COOKIEHASH );
define( 'AUTH_COOKIE', WP_DEFAULT_THEME . '_' . COOKIEHASH );
define( 'PASS_COOKIE', WP_DEFAULT_THEME . 'pass_' . COOKIEHASH );
define( 'USER_COOKIE', WP_DEFAULT_THEME . 'user_' . COOKIEHASH );
define( 'RECOVERY_MODE_COOKIE', WP_DEFAULT_THEME . '_rec_' . COOKIEHASH );
//define( 'COOKIE_DOMAIN', 'www.something.com' );
define( 'PLL_COOKIE', 'lang' );
/* Content */
define( 'AUTOSAVE_INTERVAL', 30 ); // seconds
if ( ! defined( 'WP_POST_REVISIONS' ) )
define( 'WP_POST_REVISIONS', 5 );
define( 'MEDIA_TRASH', false );
define( 'EMPTY_TRASH_DAYS', 7 );
define( 'WP_MAIL_INTERVAL', 5 * MINUTE_IN_SECONDS );
/* SMTP */
define( 'SMTP_USER', '' ); // Username to use for SMTP authentication
define( 'SMTP_PASS', '' ); // Password to use for SMTP authentication
define( 'SMTP_HOST', '' ); // The hostname of the mail server
define( 'SMTP_FROM', '' ); // SMTP From email address
define( 'SMTP_NAME', '' ); // SMTP From name
define( 'SMTP_PORT', '' ); // SMTP port number - likely to be 25, 465 or 587
define( 'SMTP_SECURE', false ); // Encryption system to use - ssl, tls or false
define( 'SMTP_AUTH', false ); // Use SMTP authentication (true|false)
define( 'SMTP_DEBUG', 0 ); // for debugging purposes only set to 1, 2, 3
/* Memory */
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
/* Updating */
define( 'AUTOMATIC_UPDATER_DISABLED', false );
define( 'WP_AUTO_UPDATE_CORE', 'minor' );
define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true );
define( 'WP_AUTO_UPDATE_PLUGIN', true );
define( 'WP_AUTO_UPDATE_TRANSLATION', true );
if ( ! defined( 'WP_INSTALLING' ) )
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', false );
/* File edition */
define( 'DISALLOW_FILE_MODS', false );
define( 'DISALLOW_FILE_EDIT', true );
define( 'IMAGE_EDIT_OVERWRITE', true );
/* Performance */
define( 'WP_CACHE', true );
define( 'WP_CACHE_KEY_SALT', 'qkfvmbjt33yt458jwj:' );
define( 'COMPRESS_CSS', true );
define( 'COMPRESS_SCRIPTS', true );
define( 'CONCATENATE_SCRIPTS', true );
define( 'ENFORCE_GZIP', true );
/* Cron */
define( 'DISABLE_WP_CRON', false );
define( 'ALTERNATE_WP_CRON', false );
define( 'WP_CRON_LOCK_TIMEOUT', 60 );
/* FTP Access */
/*
define( 'FS_METHOD', 'ftpext' );
define( 'FTP_BASE', ABSPATH );
define( 'FTP_CONTENT_DIR', WP_CONTENT_DIR );
define( 'FTP_PLUGIN_DIR ', WP_PLUGIN_DIR );
define( 'FTP_LANG_DIR', WP_LANG_DIR );
define( 'FTP_PUBKEY', ABSPATH . '/.ssh/id_rsa.pub' );
define( 'FTP_PRIKEY', ABSPATH . '/.ssh/id_rsa' );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org' );
define( 'FTP_SSL', false );
define( 'FS_TIMEOUT', 30 );
define( 'FS_CONNECT_TIMEOUT', 30 );
*/
/* SFTP Access */
/*
define( 'FS_METHOD', 'ssh2' );
define( 'FTP_BASE', ABSPATH );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org' );
define( 'FTP_PUBKEY', ABSPATH . '/.ssh/id_rsa.pub' );
define( 'FTP_PRIKEY', ABSPATH . '/.ssh/id_rsa' );
define( 'FTP_SSL', true );
define( 'FS_TIMEOUT', 30 );
define( 'FS_CONNECT_TIMEOUT', 30 );
*/
/* Plugins Must-Use */
/* Filtering */
define( 'DISALLOW_UNFILTERED_HTML', false );
define( 'ALLOW_UNFILTERED_UPLOADS', false );
/* Feed reader */
define( 'MAGPIE_CACHE_ON', true );
define( 'MAGPIE_CACHE_DIR', 'cache' );
define( 'MAGPIE_CACHE_AGE', 3600 );
define( 'MAGPIE_CACHE_FRESH_ONLY', false );
define( 'MAGPIE_DEBUG', false );
define( 'MAGPIE_USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0' );
define( 'MAGPIE_FETCH_TIME_OUT', 5 );
define( 'MAGPIE_USE_GZIP', true );
/* MultiSite */
/*
define( 'WP_ALLOW_MULTISITE', true );
define( 'ALLOW_SUBDIRECTORY_INSTAL', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', $_SERVER['SERVER_NAME'] );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1) ;
define( 'BLOG_ID_CURRENT_SITE', 1 );
define( 'WPMU_ACCEL_REDIRECT', false );
define( 'WPMU_SENDFILE', false );
define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
define( 'NOBLOGREDIRECT, '%siteurl%' );
*/
/* Domain mapping plugin */
//define( 'SUNRISE', false );
/* External URL Requests */
define( 'WP_HTTP_BLOCK_EXTERNAL', false );
if ( WP_HTTP_BLOCK_EXTERNAL ) {
define( 'WP_ACCESSIBLE_HOSTS', '*.wordpress.org,*.github.com' );
}
/* File permissions */
//define('FS_CHMOD_DIR', (0755 & ~ umask()));
//define('FS_CHMOD_FILE', (0644 & ~ umask()));
/* Proxy */
/*
define('WP_PROXY_HOST', '' );
define('WP_PROXY_PORT', '' );
define('WP_PROXY_USERNAME', '' );
define('WP_PROXY_PASSWORD', '' );
define('WP_PROXY_BYPASS_HOSTS', 'localhost' );
*/
/* Debug */
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', ROOT . '/error_php.log' );
//define( 'WP_DEBUG_LOG', ROOT . '/error_php_' . date('Y-m-d') . '.log' );
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', false );
define( 'WP_SANDBOX_SCRAPING', false ); // Turn off WSOD Protection (and don't send email notification)
define( 'WP_START_TIMESTAMP', microtime( true ) ); // Modify the WordPress start time.
define( 'SCRIPT_DEBUG', false );
define( 'SAVEQUERIES', true );
define( 'DIEONDBERROR', false ); //$wpdb->print_error() and multisite
define( 'ERRORLOGFILE', ROOT . '/error_database.log' );
/**
* Allow WordPress to detect HTTPS when used behind a reverse proxy or a load balancer
* See https://codex.wordpress.org/Function_Reference/is_ssl#Notes
*/
if ( isset( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] ) && $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] === 'https' ) {
$_SERVER[ 'HTTPS' ] = 'on';
}
if ( ! defined( 'ABSPATH' ) )
define( 'ABSPATH', WEB_ROOT . '/wp/' );
require_once ABSPATH . 'wp-settings.php';
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about
define( 'UPLOADS', 'uploads' )
?