Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to build a new WordPress theme using register_post_type to create a custom post type called listings.

I would like each listing to have the following permalink structure:

http://www.mysite.com/%author%/listing-title

I'm not quite sure how to achieve this with the CPT controls listed in the Codex. Previously, I have a achieved a similar effect by creating a custom structure in Permalink Settings:

/%author%/%postname%/

It has been suggested on the main forum that I use wp_rewrite, but wp_rewrite only seems to deal with incoming requests and does not change the way CPT posts are created.

To illustrate further with an image, I want to change the /listings/ part of the permalink URL to the post author's name. See image below.

alt text

share|improve this question

1 Answer 1

up vote 3 down vote accepted

My plugin Custom Post Permalinks allows you to set permalink structures for custom post types and it supports post authors as part of a permastruct. However, while my plugin will enable you to set up that structure, I don't suggest using that structure. That structure will essentially make WordPress interpret all top-level pages as 404 errors (and second level pages, I think). You should be fine if you add the post type to anchor the beginning of the structure like this:

/%post_type%/%author%/%postname%/
share|improve this answer
    
Cool, thanks. I'll check that out. –  jnthnclrk Oct 21 '10 at 21:19
    
Cool plugin, works great! –  jnthnclrk Oct 22 '10 at 12:31
    
I followed your advice and accepted the need to maintain the initial /%post_type%/ section. But am now thinking it would be nice to add a /blog/ section to my non-custom post types for consistency. –  jnthnclrk Oct 22 '10 at 12:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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