Using “category” to start permalinks
For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text “page slug” as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best to start your permalink structure with a numeric field, such as the year or post ID. See wp-testers discussion of this topic.
Thanks for the info… particularly the link.
So I’m thinking I may have no other option than to add the year or post ID. This is for a site that DOES have a current news/blog section (which benefits from the date) but the prime content is more evergreen, which is why I opted not to include the year/month in the first place.
Does anyone know if search engines put any weight to the link structure… as in whether a date is good now, but bad later when the date is old?
I read through the wp-testers discussion thread again and I’ve been doing my research before switching my permalink structure and frankly, I seem to find a lot of people using /%category%/%postname%/ as a custom option… this is not to say that it is wise, but it is fairly common.
In fact, several of the plugins I looked at that allow either multiple permalink structures (Advanced Permalinks, for one) or help you migrate links (Redirection, same author), even have features to use /%category%/ to start the link structure.
So this leads me to a few questions that I’m hoping someone can shed some light on:
If I change my entire structure to begin with the year or post ID, doesn’t WordPress handle this with the proper redirect already?
If I change my entire structure to begin with the year or post ID, does the single database field in the wp_options table that holds all the current information shrink back down to a more manageable (read: faster) size?
Will this “shortcoming” be changed in a future version of WordPress that make my concerns irrelevant for now?
And finally, does using a plugin like WP Super Cache help with this issue?
Bump… I would also really like clarification on Dave’s concerns.
Maybe you’ve figured it out since your post, Dave? If so, feel free to enlighten me on this;-)
Basically it boils down to – “how busy is your site? Do you have a large number of posts/pages?”
If neither of these, the structure is just fine.
If either/both, you are causing a huge amount of queries that will eventually slow things down.
Read the ditestes discussion and decide for your self
Just to add to the discussion – I recently was working on a site that had a massive amount of content. We ended up with about 500 or so pages, and over 1500 media files that we imported using a custom import script.
Originally we had the %category% tag in the permalink (out of ignorance of this issue). As soon as we imported this content we found the site taking nearly 10 seconds to even begin displaying a page. I suspected an issue with the database calls and low and behold – each page was running over 1200 queries on each load!! Once we switched the permalink structure to a %postid%/%postname% it jumped back down to about 10 or so.
Noticed that your permalink structure is missing an underscore jkriddle. Correct structure is:
But, well, isn’t just _that_ one big advantage for search engine friendly urls to have the actual names of a site stucture (which nearly almost _is_ category/pagename) represented in the links?
Also it’s the best way for humans, if – and that’s the _big_if i am stumbling upon since i began to believe WordPress can easily be used as a CMS – the content happens to be better _not_ be structured by a timeline-oriented system. But that’s what WordPress seems to be through and through. It’s a blog. A blog is a blog is a … not a CMS.
@notknow: you bring up a very good point regarding this whole issue. However,
actual names of a site stucture (which nearly almost _is_ category/pagename)[emphasis added]
Pages–that is PAGES pages, WordPress’s static Pages–are referenced using
parent-page/child-page/grandchild-page/etc.. So for Pages, that is not an issue when using pretty Permalinks. Their URI will be rewritten according to their hierarchy, just like the pages in a “real” HTML site.
That is actually the reason why it is a performance issue: it takes longer for WordPress to determine if the URI refers to a page name, or to a category. Posts, by nature, are small packets of information, floating around in the database, able to be called on just about any page in your blog. The permalink, however, is a place where that post can always be found: the link stays the same. For most purposes using posts, it is fine for the URI to the
singlepage for that post to contain numerical data (such as the date).
I hope this makes things more clear; you can read the Codex article more in-depth for further information.
- The topic ‘Using “category” to start permalinks’ is closed to new replies.