[wp-hackers] Some Thoughts/Enhancement Ideas InAndAroundTheCategory Side Of Things

Hikari lists at hikarinet.info
Sun Feb 14 07:27:02 UTC 2010

----- Original Message ----- 
From: "Mark McWilliams" <admin at wpkid.com>
To: <wp-hackers at lists.automattic.com>
Sent: Sunday, 14 February, 2010 12:32 AM
Subject: Re: [wp-hackers] Some Thoughts/Enhancement Ideas InAndAroundTheCategory Side Of Things

| what's wrong with something like...?
| http://www.site.com/contact/ - Which will be a page!
| /?post=hello-world
| /?page=contact
| /?taxonomy=people
| http://www.site.com/hello-world/ - That'll be the post URL!
| /?post=hello-world
| /?page=contact
| /?taxonomy=people
| http://www.site.com/people/ - And oddly enough, we have the custom taxonomy!
| /?post=hello-world
| /?page=contact
| /?taxonomy=people
| So in theory, what it'll do is search between a POST, PAGE and TAXONOMY for
| a match! =)
| Have I just completely missed the point, or what, to me that looks pretty | simple!

It's simple to understand, but expensive to run.

My site has 276 posts, 6 pages, 58 categories and 1108 tags. Remember categories, tags (which were added in 2.1 or 2.3) and now 
custom tax are all in a unique table.

If it was implemented as you said, a category URL would first go throu almost 300 pages rows, (let's not think it would first query 
only pages and then only posts, or it would go twice on that table) then more than 1000 taxonomy rows.

Such queries are expensive because they load whole posts and taxonomies tables to get only their slug and ID. So cat base optimizes 
it, helping Wordpress easily figure out when the URL refers to a category or tag, "taking taxonomies out of equation". Get a post 
structure starting with a number, being it a date or an ID, and you have an easy way to separate different resources without needing 
to query each table.

It's for optimizing it.

That's the disadivantage of Wordpress approach, it requires quering in resources tables to find out what a URL means, and more than 

Now, take a look on how Drupal works:

1) Core: each resource has a fixed permalink of /resource/ID, it's like a very simple and cleaner Wordpress rewrite rule

2) URL Aliases module: there is a table that links each default permalink to an Alias, that can be anything and is written by user 
upon resource creating (as Custom Permalink plugin works!); by default both original and alias permalinks return the resource, there 
is a way I don't remember anymore how, that makes default permalink redirect to alias

3) Pathauto module: remebers a bit how Wordpress defines permalinks, we can set *different* permalink stuctures to *each kind* of 
resource, *including each taxonomy type we create*, and it will fill URL Alias for us

 BUT, Pathauto only does its job AFTER the post is created, we can't see how it will be before saving, not even its "slug" (I've 
just tested it here, not even previewing works, and as long as I know Drupal doesn't have sheculed posts).

So, or we have a very different permalink we wanna use for that resource, or we let Pathauto sets it and see how it becomes after 
it's created. And if we don't like Pathauto's work, we must edit the post setting our own Alias.

Pathauto needs improvements, but Drupal *totally* separates permalink-to-resource detection from resources table, at the same time 
we are able to use anything after the site's base URL.

In Wordpress, if we like its permalink structure, it's better than Drupal best solution. But if we don't, all it lets us do is 
change the resource slug, or hack its rewrite rules using custom permalink, scategory, removing category base, etc. And since it is 
so complex, any hack may add bugs.

We should have a simpler and expandable permalink code base, and add rewrite rules over it (and each or all rules would be disabled 
as needed), and add newer and better stuff with ease.

Hikari -  A Luz ilumina a PAZ

Tenha seu próprio email meunome @ ConscienciaPlanetaria.com.br!: http://seunome.ConscienciaPlanetaria.com.br 

More information about the wp-hackers mailing list