wp-config and htaccess snippets
 Share
The version of the browser you are using is no longer supported. Please upgrade to a supported browser.Dismiss

 
View only
 
 
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
FunctionCode
2
Note: all of the constants you'd use in wp-config follow the same syntax: define( 'SETTINGNAME', 'setting' ); – missing quotes, parens, or semicolon will break all the things
3
More important note: make a backup of wp-config before making edits.
4
DEBUG
5
Enable WP_DEBUG mode (not a good idea to use this on a live site)
define( 'WP_DEBUG', true ); // by default, debug messages will will be shown on the page-see below to disable this
6
Disable PHP errors, notices, and warnings
ini_set ('display_errors','Off');
ini_set ('error_reporting', E_ALL );
define ('WP_DEBUG', false);
define ('WP_DEBUG_DISPLAY', false);
7
Enable WP_DEBUG loggingdefine( 'WP_DEBUG_LOG', true ); // errors will save to debug.log in /wp-content/
8
WordPress concatenates all JS files used in wp-admin. On rare occasions this causes problems, so you can turn it offdefine( 'CONCATENATE_SCRIPTS', false );
9
10
LANGUAGE
11
Define language: Spanishdefine('WPLANG', 'es_ES');
12
Define language: Catalandefine('WPLANG', 'ca_CA');
13
Define language: Frenchdefine('WPLANG', 'fr_FR');
14
Define language: Germandefine('WPLANG', 'de_DE');
15
16
EDITING and POST MANAGEMENT
17
Reduce autosave time frequencydefine( 'AUTOSAVE_INTERVAL', 160 );
18
Restrict number of saved revisionsdefine( 'WP_POST_REVISIONS', 6 );
19
Disable post revisionsdefine( 'WP_POST_REVISIONS', false );
20
Empty trashdefine( 'EMPTY_TRASH_DAYS', 30 ); // 30 days
21
Enable Media trash (so deleted media isn't gone immediately)define( 'MEDIA_TRASH', true );
22
23
UPDATES
24
Disable re-installation of WP default themes on core updatedefine('CORE_UPGRADE_SKIP_NEW_BUNDLED', true);
25
Disables all core updatesdefine('WP_AUTO_UPDATE_CORE', false );
26
Enables all core updates including minor and major:define('WP_AUTO_UPDATE_CORE', true );
27
Enables core updates for minor releases (default):define('WP_AUTO_UPDATE_CORE', 'minor' );
28
Disable all types of automatic updates, core or otherwisedefine( 'AUTOMATIC_UPDATER_DISABLED', true );
29
30
SECURITY
31
Disable Plugin and Theme Editing in Dashboarddefine( 'DISALLOW_FILE_EDIT', true);
32
Require SSL for Admin and Logins
define( 'FORCE_SSL_ADMIN', true ); //note: this replaces FORCE_SSL_LOGIN, which is deprecated
33
Lock out all ability to install, update, or edit themes and plugins from within the dashboarddefine( 'DISALLOW_FILE_MODS', true );
34
35
SAVE LICENSE KEYS
36
Gravity Formsdefine( 'GF_LICENSE_KEY', 'XXXXXXXXXX');
37
Soliloquydefine( 'SOLILOQUY_LICENSE_KEY', 'XXXXXXXXXX');
38
WP Migrate DB Prodefine( 'WPMDB_LICENCE', 'XXXXXXXXXX');
39
Akismetdefine( 'WPCOM_API_KEY', 'XXXXXXXXXX' );
40
41
MULTISITE
42
Set up a redirect if visitor tries to access non-existent site or subdomain on your multisite install or registration is disableddefine( 'NOBLOGREDIRECT', 'http://your siteurl/' );
43
44
MEMORY and CACHE
45
Manage memory allotted to WordPress define( 'WP_MEMORY_LIMIT', 96M); // defined in megabytes - here it's 96 MB
46
Turn cache on and offdefine( 'WP_CACHE', false );
47
48
CRON
49
Disable cron completely; every site visit fires a cron job, which is uneccessary. You can shut cron off completely.define( 'DISABLE_WP_CRON', true );
50
Another method would be setting an interval during which cron cannot run; here it's set to once a minutedefine( 'WP_CRON_LOCK_TIMEOUT', 60 );
51
WordPress' cron doesn't play well with all hosts, in which case you can try a fallback approachdefine( 'ALTERNATE_WP_CRON', true );
52
53
Define URLs: defining these in wp-config reduces database calls for a slight improvement in site performance. Note: do not include a trailing /
54
Site URL (note: do not add a trailing /)define( 'WP_SITEURL', 'http://yourdomain.com' );
55
Site URL if WordPress is installed in a subdirectorydefine( 'WP_SITEURL', 'http://yourdomain.com/wordpress' );
56
Home URLdefine( 'WP_HOME', 'http://yourdomain.com' );
57
58
DATABASE REPAIR: Be sure to disable this feature once you're done using it
59
Enable database repair tooldefine( 'WP_ALLOW_REPAIR', true ):
60
61
PLUGIN SPECIFIC CHANGES
62
Removes Modern Tribe Events from WP Admin Bardefine('TRIBE_DISABLE_TOOLBAR_ITEMS', true);
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Loading...
Main menu