WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
What is your $ rewrite_tag? – Bainternet Apr 14 '11 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 Apr 15 '11 at 10:17

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.

share|improve this answer

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

share|improve this answer

Your Answer


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