Skip to content

Instantly share code, notes, and snippets.

@bagerathan
Created August 21, 2021 14:24
Show Gist options
  • Save bagerathan/8fab7f28f99d30da1dcbeec468a2da15 to your computer and use it in GitHub Desktop.
Save bagerathan/8fab7f28f99d30da1dcbeec468a2da15 to your computer and use it in GitHub Desktop.
[wp-config customisations] #wp
//difine default theme
define( 'WP_DEFAULT_THEME', 'default-theme-folder-name' );
//diable autoupdate
define( 'AUTOMATIC_UPDATER_DISABLED', true );
//only disable core updates
define( 'WP_AUTO_UPDATE_CORE', false )
//enable trash for media
define( 'MEDIA_TRASH', true );
//skip wp-content while upgrade
define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true );
//allow any file to be uploaded
define( 'ALLOW_UNFILTERED_UPLOADS', true );
//define wp-lang dynamically on multilanguage website. Have a look at wp-lang.php as well.
require_once( dirname( __FILE__ ) . '/wp-lang.php' );
//permanantly fefine wp.com api
define( 'WPCOM_API_KEY', 'YourKeyHere' );
//empty trash automatically
define ('EMPTY_TRASH_DAYS', 7);
//disable trash
define ('EMPTY_TRASH_DAYS', 0);
//reduce number of revisions
define( 'WP_POST_REVISIONS', 3 );
//disable revisions
define( 'WP_POST_REVISIONS', false );
//change autosave interval
define( 'AUTOSAVE_INTERVAL', 180 );
//change wp-contnet folder location
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/anotherfolder/wp-content' );
//increase memory
define( 'WP_MEMORY_LIMIT', '64M' );
//disable theme and plugin editor
define( 'DISALLOW_FILE_EDIT', true );
//define FTP details
define('FTP_HOST', 'ftp.yoursite.com');
define('FTP_USER', 'Your_FTP_Username');
define('FTP_PASS', 'Your_FTP_password');
define('FTP_SSL', true); // If you can use a SSL connection set this to true
//define URL
define('WP_HOME', 'http://www.yourwebsite.com');
define('WP_SITEURL', 'http://www.yourwebsite.com');
// start the session
session_start();
// if there's a "lang" parameter in the URL...
if( isset( $_GET[ 'lang' ] ) ) {
// ...set a session variable named WPLANG based on the URL parameter...
$_SESSION[ 'WPLANG' ] = $_GET[ 'lang' ];
// ...and define the WPLANG constant with the WPLANG session variable
define( 'WPLANG', $_SESSION[ 'WPLANG' ] );
// if there isn't a "lang" parameter in the URL...
} else {
// if the WPLANG session variable is already set...
if( isset( $_SESSION[ 'WPLANG' ] ) ) {
// ...define the WPLANG constant with the WPLANG session variable
define( 'WPLANG', $_SESSION[ 'WPLANG' ] );
// if the WPLANG session variable isn't set...
} else {
// set the WPLANG constant to your default language code is (or empty, if you don't need it)
define( 'WPLANG', 'tr_TR' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment