---
title: Getting PHP Speedy Plugin to Work with WordPress 2.6
date: 2008-07-04T10:34:02+00:00
modified: 2010-04-25T18:37:13+00:00
permalink: https://kaspars.net/blog/php-speedy-plugin-wordpress-2-6
post_type: post
author:
  name: Kaspars
  avatar: https://reverse.kaspars.net/gravatar/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?s=96&d=mm&r=g
post_tag:
  - Plugin
category:
  - WordPress
---

# Getting PHP Speedy Plugin to Work with WordPress 2.6

WordPress 2.6 significantly improves the way JavaScript **and CSS** files can be added to the HTML `<head>`, and because of these changes the methods of [`WP_Scripts` class](http://trac.wordpress.org/browser/trunk/wp-includes/class.wp-scripts.php "View the updated class.wp-scripts.php") have been altered a lot.

![](https://kaspars.net/wp-content/uploads/2008/03/php_speedy_logo_medium.gif?strip=all&quality=90&resize=200,61 "WordPress plugin PHP Speedy logo") Therefore [PHP Speedy](http://aciddrop.com/2008/03/22/php-speedy-wordpress-plugin-version-04 "Speed up your WordPress blog with PHP Speedy") — my favourit plugin which I think should be incorporated into the WordPress core — requires the following changes to work with WordPress 2.6.

**Replace** lines 774 to 787 in `php_speedy_wp.php`:

```
if(!method_exists($wp_scripts,'default_scripts')) {
   $wp_scripts = new WP_Scripts();
   $wp_scripts->default_scripts();
}

//Which libraries are used by this installation?
foreach($wp_scripts->scripts AS $object) {
```

**with**:

```
// check if $wp_scripts is loaded and not empty
if(!is_object($wp_scripts) && empty($wp_scripts)) {
   $wp_scripts = new WP_Scripts();
}

if (method_exists($wp_scripts,'default_scripts')) {
   // if wp 2.5
   $wp_did_register = $wp_scripts->scripts;
} else {
   // if wp 2.6
   $wp_did_register = $wp_scripts->registered;
}

//Which libraries are used by this installation?
foreach($wp_did_register AS $object) {
```

Notice that the only change is the `$wp_scripts->registered` variable which is replacing `$wp_scripts->scripts` in WordPress 2.6.