Set Post Revisions
Before you even begin your development project, add this little gem to the wp-config file.
Nothing blows a database up like a couple hundred revisions. If you’ve already launched your site and have a zillion revisions on your pages and posts, check out this plugin called Simple Revisions Delete. It will let you delete your posts revisions individually or all at once (purge or bulk action).
define( 'WP_POST_REVISIONS', 10 );
or disable them altogether:
define( 'WP_POST_REVISIONS', false );
Set Expires Cache
Resolve Caching issues for files served directly from your website by adding this piece of code to your .htaccess file.
# START EXPIRES CACHE
ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/xhtml-xml "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"
# END EXPIRES CACHE
Add Cache-Control Headers
Cache-control is an HTTP header used to specify browser caching policies in both client requests and server responses. Policies include how a resource is cached, where it’s cached and its maximum age before expiring (i.e., time to live). Also add to your .htaccess file.
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpeg|jpg|png|gif|swf|pdf|svg)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
# END Cache-Control Headers
Turn Off ETags
A response header that identifies the version of served content according to a token – a string of characters in quotes, e.g., “123123123-ab34” – that changes after a resource is modified. If a token is unchanged before a request is made, the browser continues to use its local version. Also add to your .htaccess file.
# BEGIN Turn ETags Off
FileETag None
# END Turn ETags Off
Last Resort
Setting the WP_HTTP_BLOCK_EXTERNAL constant to true in your wp-config.php file will stop all outgoing network requests from your site. Meaning, no talking to the WordPress mother ship, or any other external resources that phone home. While this may speed things up, if may mean you need to localize any libraries that are called remotely like google fonts and other scripts.
define('WP_HTTP_BLOCK_EXTERNAL', true);
Disable CRON
This basically prevents WordPress from checking for scheduled events on every page load. Add this to the wp-config.php right after the /* That’s all, stop editing! Happy blogging. */ line.
define('DISABLE_WP_CRON', true) ;