Skip to content

Instantly share code, notes, and snippets.

@sumonst21
Forked from MikeNGarrett/wp-config.php
Created September 27, 2021 18:17
Show Gist options
  • Select an option

  • Save sumonst21/c9a6d4cfefab48c3f740c7db65b9b60e to your computer and use it in GitHub Desktop.

Select an option

Save sumonst21/c9a6d4cfefab48c3f740c7db65b9b60e to your computer and use it in GitHub Desktop.

Revisions

  1. @MikeNGarrett MikeNGarrett revised this gist Mar 8, 2021. 1 changed file with 25 additions and 9 deletions.
    34 changes: 25 additions & 9 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,9 @@
    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 );

    @@ -23,11 +26,22 @@
    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 );

    @@ -54,7 +68,6 @@
    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 );
    @@ -65,15 +78,14 @@
    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);

    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', 60 ); // limit cron runs to a certain interval.
    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
    @@ -98,11 +110,15 @@
    define( 'WP_LANG_DIR', dirname(__FILE__) . 'wordpress/languages' );

    // Trash
    define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days
    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.
    define( 'WP_FEATURE_BETTER_PASSWORDS', true ); // Remove better password feature.
    // 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.
  2. @MikeNGarrett MikeNGarrett revised this gist Nov 8, 2019. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion wp-config.php
    Original file line number Diff line number Diff line change
    @@ -59,11 +59,16 @@
    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 debug
    // 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 );
  3. @MikeNGarrett MikeNGarrett revised this gist Oct 18, 2019. 1 changed file with 17 additions and 1 deletion.
    18 changes: 17 additions & 1 deletion wp-config.php
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,15 @@
    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 );
    @@ -84,4 +93,11 @@
    define( 'WP_LANG_DIR', dirname(__FILE__) . 'wordpress/languages' );

    // Trash
    define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days
    define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days

    // Dev tools
    define( 'SHORTINIT', false ); // Disable most of WordPress. Useful for fast responses for custom integrations.
    define( 'WP_FEATURE_BETTER_PASSWORDS', true ); // Remove better password feature.

    // Recovery mode and fatal error handling.
    define( 'WP_SANDBOX_SCRAPING', true ); // Turn off WSOD Protection (and don't send email notification)
  4. @MikeNGarrett MikeNGarrett revised this gist Oct 18, 2019. 1 changed file with 29 additions and 8 deletions.
    37 changes: 29 additions & 8 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    <?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' );
    @@ -15,6 +20,9 @@

    // 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
    @@ -23,6 +31,9 @@
    // 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
    @@ -38,19 +49,17 @@
    // WordPress debug on and off
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', true );

    // Script 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.

    // 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 );
    define( 'ALTERNATE_WP_CRON', true ); // alternate method of firing cron in the background when initiated by end users.
    define( 'WP_CRON_LOCK_TIMEOUT', 60 ); // limit cron runs to a certain interval.

    // SSL
    define( 'FORCE_SSL_LOGIN', true ); // Only secrue the registration/login process
    @@ -60,7 +69,19 @@
    define( 'WP_HTTP_BLOCK_EXTERNAL', true );
    define( 'WP_ACCESSIBLE_HOSTS', 'api.wordpress.org,*.github.com' ); // Only allow particular hosts in

    // Bad idea
    // 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
    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 ); // 30 days
  5. @MikeNGarrett MikeNGarrett revised this gist Nov 9, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,9 @@
    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
  6. @MikeNGarrett MikeNGarrett created this gist Nov 9, 2015.
    63 changes: 63 additions & 0 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,63 @@
    <?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 ) );


    // 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