I've browsed tons of Q/A on stackexchange, google, wordpress forums... but haven't found yet a definitive answer to what looks like to be a common issue since the introduction of custom post types.

I've set my permalinks structure from Wordpress admin permalink settings page as:


since this is a good practice to improve database performance

however, I noticed my custom post types (I have several in one configuration) still appear as:


while what I really want is


and actually would love if it could also work as


but as for now, I would like to get the post_id work in the cpt structure

how to achieve this?

there was a wordpress plugin but apparently it was withdrawn because had some issues (and anyway is no longer mantained)

  • >"since this is a good practice to improve database performance" Note that this will no longer be the case in WordPress 3.3 which is being released imminently. You can just use /%postname%/ without performance penalty. Nov 16, 2011 at 23:30
  • oh yeah I actually just read that after posting, good anyway from a SEO point of view it would be nice to have the %taxonomy% in the cpt permalink displayed thanks
    – unfulvio
    Nov 17, 2011 at 9:38

2 Answers 2

function myrules(){

Replace the 'yourcptslughere' with what you wanted, and then add that to functions.php then flush your rewrite rules, and the final example you posted should work. I doubt it will be what the_permalink() returns however so you will have to construct the urls yourself, however they should be viewable at those URLs e.g.:

  • I think you can skip matching the name and taxonomy, when you are already looking up post via post_id. so index.php?p=$matches[1] will be enough. Nov 17, 2011 at 14:31
  • Indeed! Although I put the whole thing in just encase
    – Tom J Nowell
    Nov 17, 2011 at 15:57

WordPress are working on increasing the performance of Custom Permalink Structures which is supposed to be completed on the next update

  • ok, you mean 3.3? that would be awsome
    – unfulvio
    Nov 17, 2011 at 9:38

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.