Here are some optimization techniques to optimize your WordPress site for Google Page Speed 1.10.2, Yahoo YSlow 2.1.0, and Zoompf.
I installed a completely new WordPress 3.1 site with no plugins and using the default Twenty Ten theme.
Here are the relevant scores on a fresh install:
Test | Score |
---|---|
Page Speed | 87 |
YSlow | 93 |
Zoompf | 49 |
- Edit your .htaccess file by adding the following:
Header unset ETag FileETag None ExpiresActive on ExpiresByType image/jpeg "access plus 6 months" ExpiresByType image/png "access plus 6 months" ExpiresByType image/gif "access plus 6 months" ExpiresByType image/x-icon "access plus 6 months" ExpiresByType text/css "access plus 6 months" ExpiresByType application/javascript "access plus 6 months" ExpiresByType application/x-javascript "access plus 6 months" AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/javascript application/x-javascript
- In your /wp-content/themes/twentyten/header.php remove the following line: (this removes the charset from your page because it’s not needed if the web server is using the HTTP Content-Type header to define the character set)
<meta charset="" />
- In your /wp-content/themes/twentyten/functions.php add the following: (this removes the ability to use remote editing)
function remheadlink() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); } add_action('init', 'remheadlink');
- Optimize the /wp-content/themes/twentyten/images/wordpress.png using a tool such as ImageOptim. This will reduce the size of the image from 849 bytes to 661 bytes without losing any quality.
- Optimize the /wp-content/themes/twentyten/images/headers/path.jpg by saving it with a jpeg quality setting of 75% using your favorite image editing tool and then using a tool like ImageOptim. This will reduce the size of the image from 51,727 bytes to 42,154 bytes without losing too much quality.
- Minify the /wp-content/themes/twentyten/styles.css using the YUI Compressor tool.
Here are the new scores after optimization:
Test | Score |
---|---|
Page Speed | 99 |
YSlow | 98 |
Zoompf | 84 |
Here are the remaining issues:
Page Speed:
- Use efficient CSS selectors
- Minify HTML
YSlow:
- Use a Content Delivery Network (CDN)
Zoompf:
- RSS Feed Without Blackout Period (skipDays)
- RSS Feed Without Blackout Period (skipHours)
- RSS Feed Without Caching (TTL tag)
- Dynamic HTML Not Minified
- Potentially Cacheable Text Response (iPhone)
- Uncacheable Response (iPhone)
WordPress Optimization for Mere Mortals
Here is the slide deck from my presentation at WordCamp SLC 2012 on “WordPress Performance Optimization for Mere Mortals”.
I hope you learned some simple steps on how to optimize your WordPress site.