2

Is it a good idea to design a permalink structure from scratch?

The requirements to the structure are as follows:

  • Pages to be referenced by their structure (example.com/grandparent-slug/parent-slug/child-slug).
  • Posts to be referenced by category and date (example.com/category-slug/2013/07/my-post-slug).
  • Archives only available by category (example.com/category-slug), by category and year (example.com/category-slug/2013) by category, year and month (example.com/category-slug/2013/07) and by tag (example.com/tags/tag-slug).
  • All other links, like comments, feeds, trackbacks, pagination, archive by author and day, attachments are to be disabled.

Is it a better idea to create a new structure following these requirements or to modify an existing structure? In case of a new structure, how does one go about the permalink setting in WP admin? They are site-specific, and the theme needs to override them.

2
  • Could you please use code-MarkUp and example.com instead of mysite.com - it's kind of a well known standard and easier to read. Thanks.
    – kaiser
    Commented Aug 1, 2013 at 13:24
  • I think the page structure is that way by default, adding category to post URL is definitely possible, but I'd be interested to see what you come up with for category archives by month. Commented Aug 1, 2013 at 16:25

2 Answers 2

0

It's a good idea when you don't want to use the default structure :)

There are a lot (like really a lot..) of cases when site planning includes URL structure, it's best to really have a grasp of this plan before you begin.

I would go as far as graphing out a representation of the relationships/slugs, that way you can compare it with the "default" structure to figure out if you can make an easy hack (hierarchy/hook) or you need something from scratch.

The http://codex.wordpress.org/Class_Reference/WP_Rewrite API is comprehesive and daunting at the same time.

I really recommend using CPT's http://codex.wordpress.org/Function_Reference/register_post_type to create the custom structure instead of bending over the defualt posts/pages. It will make your life easier.

-2

WordPress comes with its own default URL structure, so you can't really make a permalink structure from scratch, it's best to modify the existing structure

You can edit the default structures to some degree within the Settings > Permalinks menu.

If you want to be able to change them further for your use, use a plugin that supports multi-site or add your PHP code within your themes functions.php

Also, my answer to the question 'Is it a good idea to design a permalink structure from scratch?' and 'whether I should, considering how this would interact with the settings in the permalinks menu' is no. Technically possible, yes.

WP comes with good pretty permalinks. I don't see value in needing to change them. From an end-user perspective, having good, clean navigational links in your theme will suffice. From an SEO perspective, I would keep the urls short and clear - but not bet on them giving me an SEO edge. From a dev perspective, my time can be put to better use since the defaults good.

Most of what you want is easily achieved:

5
  • I certainly can make a totally new set of rules, by using the rewrite_rules_array hook. However, the question is whether I should, considering how this would interact with the settings in the permalinks menu. Commented Aug 1, 2013 at 16:10
  • Sorry, but that isn't true. Not in a single piece.
    – kaiser
    Commented Aug 1, 2013 at 22:48
  • what isn't true? could you please explain?
    – forlogos
    Commented Aug 7, 2013 at 19:53
  • It's not true at all because WordPress has a complete codex.wordpress.org/Class_Reference/WP_Rewrite API amongst other things.
    – Wyck
    Commented Aug 8, 2013 at 6:42
  • ahh, ok, so it is possible to design your permalink structure from scratch But that knowledge has no impact on my opinion of the OP's question. Technically, of course he could. But not knowing the reasons for his requirements and presented only with "whether it is a good idea/whether he should", I stick to my response of no.
    – forlogos
    Commented Aug 9, 2013 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.