Geeky bits in WordPress 2.9


WordPress »
25 November, 2009 – 45 Comments

Thanks to Peter Westwoord’s WordPress Beta Tester plugin, this blog is on the 2.9 development track again, after having been off trunk for a couple of months. That plugin makes it really easy to switch any WordPress install to the development branch, either for the next “point” release (eg. 2.8.6), or the next major version, in this case, 2.9.

Check out Technosailor’s great post on most of the new features for users. Below I’ve gathered a list of things especially relevant for readers of this blog and for developers like myself.

Support for rel=”canonical”

WordPress now has rel="canonical" support built in, there by making my Canonical URL’s for WordPress plugin obsolete, as expected.

Enhancements to wp_query

Although this is more for the geeks, I’d been fighting this one for a while now without realizing it: you could only get $wp_query to either return one type of post (so ‘post’, or ‘page’ or ‘attachment’) or ANY type of post, but not all posts and pages. You can now, IMHO, that’s a major improvement.

Performance updates to options table

It’s a long story, but if you like databases and optimization, this thread on Trac is worth a read. In short: the options table is now more optimized than it was before.

Upgraded TinyMCE

Highlights of that upgrade (here’s the Trac ticket):

  • Empty P tags are not stripped off and would show in the HTML editor as <p> </p>
  • The paste and paste from Word cleanup removes spans and inline styles.

Option to cache wp_remote_get

This might be one of my most favourite simple enhancements. It allows wp_remote_get requests to be cached, very useful, might even be worth adding into a plugin like Frederick’s W3 Total Cache.

category-<slug>.php support

This one will be loved by theme coders all around. You can now make a category-<slug>.php template, where before you always had to make a category-<id>.php template. This one is a lot more intuitive. Incidentally, support for tag-<id>.php templates was added too.

Another major improvement in that area is that you can now make page-<slug>.php templates, so if the slug is sitemap, page-sitemap.php would always be it’s template. Nifty, huh?

Post thumbnails

Though best explained in the the post on Technosailor, you should try adding this to your themes functions.php file:

if ( function_exists( 'add_theme_support' ) )
	add_theme_support( 'post-thumbnails' );

It will add a meta box to your Write screens:

When clicked this will simply bring you to your Media Gallery and add a new link next to insert into post entitled “Use as thumbnail”:

Use as thumbnail

The image you select there can then be used with the new functions has_post_image(), get_post_image_id(), the_post_image() and get_the_post_image().

That’s a pretty cool addition for theme developers, together with the media additions, which also allow you to change just the thumbnail, this makes for a pretty decent post thumbnail feature set.

Sidebar descriptions

This new feature allows you to add a description to each sidebar in your theme. If you, like we do very often at OrangeValley, create themes with 10 or more sidebars, that really is a nice feature. It’s very simple too, all you have to do is add a description value to the array you’re using to declare sidebars:

if ( function_exists('register_sidebar') ) {
    'name' => 'Complex Sidebar',
    'id' => 'complex',
    'description' => 'Here is some important considerations about Complex Sidebar',
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>',

And it’ll look like this:

sidebar description

There’s tons more new cool stuff, but this should get you started for now!

45 Responses

  1. quicoto
    By quicoto on 25 November, 2009

    I’ve got a question for you Joost.

    Is about w3 total cache plugin.

    What do you think is better w3-total-cache or WP Super Cache ?

    I’ve been reading from both and actually im using WP Super Cache.

    Waiting for your opinion.


    • Joost de Valk
      By Joost de Valk on 25 November, 2009

      W3 Total Cache, hands down.

      • quicoto
        By quicoto on 25 November, 2009

        Thanks for the fast answer i’ll try it in my blog soon.

        Do you use it for Yoast or just the tips you have in the right sidebar (hosting and stuff) ?


        • Joost de Valk
          By Joost de Valk on 25 November, 2009

          I use W3 Total Cache with memcached here yeah. It’s probably responsible for at least 50% of the speed :)

          • quicoto
            By quicoto on 25 November, 2009

            It’s me again :P Thanks for answer.

            Now im looking information about “memcached” looks pretty interesting.

            For now i’ll install the W3 Total Cache and i’ll do some tests.

            Thanks for the feedback.

        By on 26 November, 2009

        Switched over to w3 total cache plugin yesterday, wow what an improvement against wp super cache ! Thanks Joost for sharing all this wonderfull info with us.

  2. Andrea_R
    By Andrea_R on 25 November, 2009

    Very very cool geeky stuff. :D I’m especially excited about the options table & sidebar descriptions.

    • Joost de Valk
      By Joost de Valk on 25 November, 2009

      Yeah indeed, amazing how something simple as a sidebar description can make a person happy :P

  3. Johnny Krogsgård
    By Johnny Krogsgård on 25 November, 2009

    Can’t wait.. Specially the category-slug.php will help us so much, because nobody can ever remember what ID the category you want to edit has..
    Great summary, thanks.

  4. olbrzym_z_drutu
    By olbrzym_z_drutu on 25 November, 2009

    Good job on that! Can’t wait to see it walking and roaring! :) Best regards

  5. John Paul Aguiar
    By John Paul Aguiar on 25 November, 2009

    W3 Total Cache, hmm I been using Super Cache and really have not noticed much improvement.

    Time for a change,, thanks for the great tips.

  6. Sara
    By Sara on 25 November, 2009

    So much about this post has me chair-dancing. Thanks — great features, and so well explained! I really enjoy your blog and your plugins.

  7. Harsh Agrawal
    By Harsh Agrawal on 25 November, 2009

    I’m still using Super cache and was reading some tutorial shared by people on super cache vs w3 cache
    Wondering unlike supercache (apart from .htaccess) , do we need to do anything to configure w3 cache?
    And any thing in particular which w3 is missing?

    • Dre
      By Dre on 25 November, 2009

      We’ve been running W3 Cache since 2.9 rare and it is running perfectly. It is pretty straight forward to set up and not for nothing, pretty darn fast!

    • Dre
      By Dre on 25 November, 2009

      Joost, the tag templating is insane in 2.9 you have so many options it’s crazy, so from a flexibility perspective, it definitely fits the bill.


      Here is the latest template hierarchy flow:

  8. Shelley
    By Shelley on 25 November, 2009

    Thanks Joost, I’m finally starting to get excited about about the new release…I’m just still terrified about how all of this is going to impact my existing mission critical plugins and themes. I see a careful “Effected Plugins” chart in my future and many many many trips to the forums before I hit the upgrade button.

    The slug templating options are rockin’ though, can’t deny that’ll make my limited-themes-on-WPMU life easier.

  9. Guillaume
    By Guillaume on 25 November, 2009

    The post types specified in the query is a small revolution in WordPress, one step closer to use as a CMS.

    Management miniatures is also a huge bonus.

    With the v.3 and the pooling of MU, the other CMS’s will struggle to keep the comparison.

  10. Chris M
    By Chris M on 26 November, 2009

    Super list of “Geeky bits” Joost, thanks for taking the time to publish it.

  11. Luci
    By Luci on 26 November, 2009

    the category- and tag- additions just perked up my day a little bit! As well as the thumbnails… I’ve been trying to put together an RSS feed from wordpress that will pull an image, maybe this’ll help! (Although if anybody can point me in the right direction, I’d be eternally grateful)

    And there’s so many other interesting things i can’t wait to try out the new release!

  12. Coty
    By Coty on 26 November, 2009

    I found your blog today and just wanted to stop by to thank you for your high quality content.
    You just got a new reader ;)


  13. Milan
    By Milan on 28 November, 2009

    WordPress now has rel=”canonical” support built in, there by making my Canonical URL’s for WordPress plugin obsolete, as expected.

    You are wrong with this, WordPress adds rel=”canonical” only on singular pages and not on home page, archives etc. See here.

    • S.K
      By S.K on 29 November, 2009

      But you need to assign canonical URL only to the singular pages, ie, to the individual post and page. Essentially singular pages are the ones that cause confusion to the search engines in view of multiple URLs pointing to the same page.

      Archives and blog pages (home) are merely derived (and aggregated) rendering.


  14. Cristian O. Balan
    By Cristian O. Balan on 30 November, 2009

    Somebody know when we can have the stable 2.9 version ?

  15. Samantha
    By Samantha on 1 December, 2009

    Hi guys

    I just also Switched over to w3 total cache plugin,and it was great! What an improvement against wp super cache. I’m now getting excited for new release.

    Kind Regards

  16. Roy
    By Roy on 2 December, 2009

    I never thought that I would learn about a new plugin while reading comments. I’ll try out “w3 total cache plugin” as recommended. It is because I’m having trouble with the other cache plugin.

    Anyways, I hope the new version of wordpress would already include an option to cache the files, so that we won’t be needing plugins for that.

  17. Rishabh Verma
    By Rishabh Verma on 2 December, 2009

    Awesome list of the geeky changes in the new upcoming wordpress 2.9, and not to forget i learnt a lot from comments too.

  18. Nick Nelson
    By Nick Nelson on 13 December, 2009

    Hey Joost. A 2.9 question – thought it’d be good here. I’m launching a new blog soon and a plugin I want to use is only valid on 2.9. How long would you recommend waiting until using 2.9 on a production site?

    • Joost de Valk
      By Joost de Valk on 13 December, 2009

      Well… is already running on 2.9, no major hickups in there at the moment.