WP-Config Options You Probably Didn’t Know About

·

,

1. Override options “siteurl” and “home”

[code language=”php”]define(‘WP_SITEURL’, ‘http://your-sites-address.com’);
define(‘WP_HOME’, ‘http://your-sites-address.com’);[/code]

2. Revisions

[code language=”php”]define(‘WP_POST_REVISIONS’, FALSE);
define(‘WP_POST_REVISION’, 3);[/code]

3. AutoSave Interval

[code language=”php”]define(‘AUTOSAVE_INTERVAL’, 160);[/code]

4. New wp-content location

[code language=”php”]define( ‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/somewhere/wp-content’ );
define( ‘WP_CONTENT_URL’, ‘http://server.com/somewhere/wp-content’);
define( ‘WP_PLUGIN_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/somewhere/wp-content/plugins’ );
define( ‘WP_PLUGIN_URL’, ‘http://server.com/somewhere/wp-content/plugins’);[/code]

5. Manage cookie options

[code language=”php”]define(‘COOKIE_DOMAIN’, ‘www.server.com’);
define(‘COOKIEPATH’, ‘www.server.com/’ );
define(‘SITECOOKIEPATH’, ‘www.server.com/’ );
define(‘ADMIN_COOKIE_PATH’, SITECOOKIEPATH . ‘wp-admin’);[/code]

6. Debug options

[code language=”php”]define(‘WP_DEBUG’, false);
define(‘WP_DEBUG_DISPLAY’, false);
define(‘WP_DEBUG_LOG’, false);
define(‘SCRIPT_DEBUG’, true); // Enables debugging of WP’s built-in Javascript
define(‘SAVEQUERIES’, true); // Saves database queries to $wpdb->queries array for analysis (will slow down site)[/code]

7. Memory Limit

[code language=”php”]define(‘WP_MEMORY_LIMIT’, ’64M’); // Probably will be overridden by server settings, but worth trying if you get a memory error[/code]

8. Cache

[code language=”php”]define(‘WP_CACHE’, true); // Basically just includes drop-in advanced-cache.php[/code]

9. Custom wp_users and wp_user_meta tables

[code language=”php”]define(‘CUSTOM_USER_TABLE’, $table_prefix.’a_new_users_table’);
define(‘CUSTOM_USER_META_TABLE’, $table_prefix.’a_new_usermeta_table’);[/code]

10. Override default file permission

[code language=”php”]define(‘FS_CHMOD_DIR’, (0755 & ~ umask())); // Untested – use at your own risk…
define(‘FS_CHMOD_FILE’, (0644 & ~ umask())); // Untested – use at your own risk…[/code]

11. FTP and SFTP Constants

[code language=”php”]define(‘FS_METHOD’, ‘ftpext’);
define(‘FTP_BASE’, ‘/path/to/wordpress/’);
define(‘FTP_CONTENT_DIR’, ‘/path/to/wordpress/wp-content/’);
define(‘FTP_PLUGIN_DIR ‘, ‘/path/to/wordpress/wp-content/plugins/’);
define(‘FTP_PUBKEY’, ‘/home/username/.ssh/id_rsa.pub’);
define(‘FTP_PRIKEY’, ‘/home/username/.ssh/id_rsa’);
define(‘FTP_USER’, ‘username’);
define(‘FTP_PASS’, ‘password’);
define(‘FTP_HOST’, ‘ftp.example.org:21’);[/code]

12. Proxy access

[code language=”php”]define(‘WP_HTTP_BLOCK_EXTERNAL’, false);
define(‘WP_ACCESSIBLE_HOSTS’, ‘api.wordpress.org’);[/code]

Leave a Reply

Discover more from Rich Collier

Subscribe now to keep reading and get access to the full archive.

Continue reading