WordPress recently deployed the new shining version 3.0, called Thelonious with bug fixes and a lot of new (long waited) features and APIs for handling Backgrounds, Menus, Taxonomy and Custom Post Types. This last feature is available from code and any developer can define it’s own content type with different taxonomies, fields and so on.
In the default WordPress 3.0 install there isn’t any user interface for the new custom post type creation and management, only APIs! But, as we already know, the plugin writers community is really active and proposed a plugin called Custom Post Type UI that enables an intuitive and easy custom post type management and configuration.
Using different post-types we can more efficiently define our website content and structure, but what about SEO? What I needed was to provide a pretty link like “myblog.net/post-type/postname”, but WP will give me the not-so-clear link “myblog.net/post/post-type/postname”… what’s wrong? It seems that WP adds to the new Post-Type permalinks the one defined in the settings. Digging into the WP 3.0 setting I couldn’t find anything to fix this issue: any new post-type will get the “default” permalink followed by the POST-TYPE shortname and then the POST-NAME.
Digging into the new API provided by WP 3.0 called register_post_type() I noticed an interesting parameter, under the “Rewrite” parameter: it’s called “with_front”
- (boolean or array) (optional) Rewrite permalinks with this format.
- Default: true
- $args array
- ‘slug’ – prepend posts with this slug – defaults to post type’s name
- ‘with_front’ – allowing permalinks to be prepended with front base – defaults to true
So, why don’t add this feature to “Custom Post Type UI” plugin?
That’s what I’ve done! It attached to this post, it’s working only for Post-Type definition, and I’m using it on this very blog! Feel free to test it and report any issue or comment!