1. Hardcode your Blog Address and Site Address
Every time your site references your Blog Address or Site Address via WordPress template tags, a query must be made to your database.
WordPress provides a way to eliminate these unnecessary database queries by enabling us to hardcode the values directly into the PHP construct. By defining the WP_HOME and WP_SITEURL constants in your site’s wp-config.php file, you can boost performance by reducing the number of queries made to your WordPress database.
wp-config.php:
define('WP_HOME', 'https://www.my-wordpress-site.com'); // blog url
define('WP_SITEURL', 'https://www.my-wordpress-site.com'); // site url
2. Hardcode your Template and Stylesheet Paths
As with the predefined constants for Blog Address and Site Address (see previous section), you can also boost performance by eliminating database queries for your site’s Template Path and Stylesheet Path.
define('TEMPLATEPATH', '/absolute/path/to/wp-content/themes/H5');
define('STYLESHEETPATH', '/absolute/path/to/wp-content/themes/H5');
3. Disable The WordPress Cron Script
The wp-cron.php script will run once a user visits your site. If you get a lot of traffic, this could be a problem. This cron task is really necessary when you make updates in the blog. You can move this cron script to a system cron task to help lower resource usage on the server.
define('DISABLE_WP_CRON', true);
4. Post Revisions
By default, WordPress will automatically saves every revisions. As useful as this feature may be, this feature will make the MySQL Database bloated with unnecessary data, eventually it will be too big to the extend where it takes too much resources to process it, thus slowing down the site.
Depending on your needs, you can either limit it to any number of revisions or disable it all together. Personally, I think 2 revisions is good enough.
define( 'WP_POST_REVISIONS', 2 );
OR
define( 'WP_POST_REVISIONS', false );
5. Modify AutoSave Interval
WordPress uses Ajax to auto-save revisions to the post as you edit. You may want to increase this setting for longer delays in between auto-saves, or decrease the setting to make sure you never lose changes. The default is 60 seconds.
define( 'AUTOSAVE_INTERVAL', 180 ); // Seconds
6. Cleanup Image Edits
You can skip this if you do not use the image editor in WordPress. For those that have the habit of using the image editor, do not that every time you edit an image, alternate copies are created on top of the existing image. Because WordPress itself will create 3 copies of Thumbnail size, Medium size and Large Size by default, this does not include the settings for the theme. Together, there could be a total of 6 or 7 copies and so on.
define( 'IMAGE_EDIT_OVERWRITE', true );
7. Require SSL for Admin and Logins
Secure your admin area with this easy SSL definition. This feature is useful for when you want to secure logins and the admin area so that both passwords and cookies are never sent in the clear. Useful for those that login to their WordPress via public WiFi.
define( 'FORCE_SSL_ADMIN', true );
8. Disable File Editing / Plugin Theme Updates
This will block users being able to use the plugin and theme installation/update functionality from the WordPress admin area. Setting this constant also disables the Plugin and Theme editor.
define( 'DISALLOW_FILE_EDIT', true );
In addition, you can also prevent unauthorized users from updating and installing themes and plugins, and updating WordPress via admin panel.
define( 'DISALLOW_FILE_MODS', true );
All wp-config.php settings together:
define( 'WP_HOME', 'https://www.my-wordpress-site.com'); // blog url
define( 'WP_SITEURL', 'https://www.my-wordpress-site.com'); // site url
define( 'TEMPLATEPATH', '/absolute/path/to/wp-content/themes/H5');
define( 'STYLESHEETPATH', '/absolute/path/to/wp-content/themes/H5');
define( 'DISABLE_WP_CRON', true);
define( 'WP_POST_REVISIONS', 2 );
define( 'AUTOSAVE_INTERVAL', 180 ); // Seconds
define( 'IMAGE_EDIT_OVERWRITE', true );
define( 'FORCE_SSL_ADMIN', true );
define( 'DISALLOW_FILE_MODS', true );
define( 'DISALLOW_FILE_EDIT', true );
9. WordPress Autoptimize Plugin
1. Autoptimize:
Autoptimize makes optimizing your site really easy
URL: https://wordpress.org/plugins/autoptimize/