Aleksandar • Vacić

iOS bits and pieces

This blog runs WP 1.5 now

WordPress, the blogging software platform I`m using, has reached version 1.5. The news of it has spread and all reactions are really positive - I have not seen any negative comment yet.

I downloaded 1.5 on the soft-launch day, but had no time until this weekend to actually try it. I read the announcement, read the reactions and reviews, but I was mainly interested in two things:

/category-title/post-title/ permalinks and themes.


I have hacked my way to such permalinks in 1.2.1 version, but it was a lot of work. There were some loose ends left and I did not want to dive any further into it. It was also puzzling would I feel benefits from this or any future WP upgrade since all public pages on my blog used few plugins I put together, which were mostly copies of 1.2 code base.

Thus with this transition to WP 1.5, I abandoned my changes and now use integrated permalink options. First the good things - default permalinks work really well. WP will, when you save new permalink structure, update your .htaccess file with appropriate mod_rewrite rules - really great from usability perspective.

It does that each time you save the structure. Thus if you do this, then mix your own rewrite rules with WP’s, and then again save the permalink structure (for whatever reason) you will loose your rules, because WP overwrites everything inside its comment lines. Even though that’s reasonable to expect, there should be a note placed in .htaccess about this, so sleepy developers like me won’t lose more sleep when doing changes in 2am.

The one thing I don’t like is that permalinks for category are, by default, prefixed with category. Hopefully, some future version will change this default behavior. For now, I needed to hack wp-includes/classes.php file and update this line:

function get_category_permastruct() {


  if (empty($this->category_base))

      <strong>$this->category_structure = $this->front . 'category/';</strong>



into this:

$this->category_structure = $this->front;

Rewrite rules that WP creates already handle this. I’m not sure why developers add the cruft - when I removed this everything worked just fine. The only reason I can figure out is that it can collide with existing directories with the same name - category archive would not be accessible then.

This applies to me, actually. I have, for example, wch directory which contains intro and examples for the scripts, but no files in the actual directory - exactly because of this category permalink problem. That’s how I wanted it. To make permalink works, I explicitly added rules like this, after the WordPress rules:

RewriteRule ^(wch)/?$ /index.php?category_name=wch [QSA,L]

Themes and Pages

The concept of themes is good and easily extensible. I created my theme in several hours, and then spent days playing around. It’s that fun.

Pages, new feature in 1.5, are also great. Using archives.php from default theme as example, I created Feeds, monthly and category archive pages. Simple and powerful.

With pages, I think I encountered one bug. Once you add pages, WP updates its part of .htaccess, but it writes the category rules (mentioned above) to the wrong place. They should always be at the end, but it places them in the middle, before the entry and by-month rules. This in turn gives 404 for them. Make sure you check those every time you make changes in Options or add new page.

Wish list

1.5 upgrade is totally worthwhile. All the things developers did are useful and welcome.

In future versions, I would like to see:

  • clean category permalinks, without cruft, by default.

  • Option to turn paging off, on archive pages.

  • The use of normal absolute links like /browsers/, not full links like http://sitename/browsers/. There is no need to use full absolutes for every link in the blog.

  • There should be a short and long description for categories. Short one could be used for title attribute on links, and long one as description on category archive page. Since I use HTML in descriptions, it can’t go inside the title.

  • Facility to preview post using the selected theme.

  • Facility to move post between categories.

  • Facility to list posts in category, not just month.