I'm doing custom URL rewrites according to this method , which work beautifully. But as a result my regular post permalinks are broken.

So, I'm rewriting "/pagename/1232432" into "/pagename?param=1232432" like this:

    $wp_rewrite->add_rewrite_tag( $rewrite_tag, '(.+)', 'param=' );
    $rewrite_keywords_structure = $wp_rewrite->root . "%pagename%/$rewrite_tag/";

(plus all the surrounding code from the example in the link above). Works fine. However, my normal posts like "/2011/03/hello-world/" no longer work.

Any ideas?

Cheers MickP

  • What is your $ rewrite_tag?
    – Bainternet
    Commented Apr 14, 2011 at 19:14
  • bainternet: it's just $rewrite_tag = '%mytag%'; I'm not actually referring to %mytag% anywhere else, though. And am not sure if I should be..? So, in the Admin > Permalinks settings, I've just checked the "Month and name" option, i.e. /%year%/%monthnum%/%postname%/ Frederik: flushing like that doesn't solve it, sadly. Note also that I'm flushing rewrite rules on itit, exactly as in [this example][1]. [1]: matty.co.za/2009/11/custom-url-rewrites-in-wordpress
    – MickP
    Commented Apr 15, 2011 at 10:17

2 Answers 2


Well I solved it - in a rather unsatisfactory way - by explicitly re-defining the default posts rule in my own code. i.e.

$rewrite_keywords_structure = $wp_rewrite->root."/%year%/%monthnum%/%postname%/";

I don't really understand why this is necessary, but there you go.


Have you tried to flush your permalinks? Visiting Admin > Settings > Permalinks should do it.

Your Answer

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