Skip to content

Instantly share code, notes, and snippets.

@mrtonyhuynh
Forked from MikeNGarrett/wp-config.php
Created December 4, 2017 13:55
Show Gist options
  • Save mrtonyhuynh/be4d7ae4b4f294e4dd8335c1e742d7ec to your computer and use it in GitHub Desktop.
Save mrtonyhuynh/be4d7ae4b4f294e4dd8335c1e742d7ec to your computer and use it in GitHub Desktop.
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
// 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'] );
// Temporary for causing a site to relocate. Remove after login.
define( 'RELOCATE', true );
// Allow WordPress to update files
define( 'FS_METHOD', 'direct' );
// 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
// Set post revisions to something feasible
define( 'WP_POST_REVISIONS', 15 );
// 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 ) );
// WordPress debug on and off
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
// Script debug
define( 'CONCATENATE_SCRIPTS', false ); // Causes WordPress scripts to be included separately
define( 'SCRIPT_DEBUG', true ); // Uses unminified scripts
// Disable WP cron in favor of server cron
define( 'DISABLE_WP_CRON', true );
// Kill the WordPress file editor
define( 'DISALLOW_FILE_EDIT', true );
// Don't allow users to update core, plugins, or themes
define( 'DISALLOW_FILE_MODS', true );
// 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
// Bad idea
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment