Optimize WordPress for Page Speed YSlow and Zoompf

WordPressHere 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
  1. Edit your .htaccess file by adding the following:
    <IfModule mod_headers.c>
    Header unset ETag
    FileETag None
    </IfModule>
    
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType image/jpeg "access plus 6 months"
    ExpiresByType image/png "access plus 6 months"
    ExpiresByType image/gif "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"
    </IfModule>
    
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/javascript application/x-javascript
    </IfModule>
  2. 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="<?php bloginfo( 'charset' ); ?>" />
  3. 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');
  4. 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.
  5. 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.
  6. 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)

I hope you learned some simple steps on how to optimize your WordPress site.

Advertisement

About John Levandowski

An irish ute working as a business intelligence engineer, Posting about Blackjack, Business Intelligence, and WordPress, Developing iPhone applications, Sharing photos

Posted on February 24, 2011, in WordPress and tagged , , , , , , , . Bookmark the permalink. Leave a Comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.