I had some rewrite rules in my functions.php file. I decided that I didn't need them, and removed all rewrite rules and then flushed them. However for some reason when I use get_permalink() the url is wrong. It's still getting the old rule. I already cleared the cache and also tried accessing from a incognito window. The .haccess file in the root has the same basic WP rewrite.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Any ideas why I am still getting the old url? I also went to each post and saved it again, hoping that would reset the url back.


I checked the database and under the options table I have an option called rewrite_rules, which has the old rules there. I removed them, but they are added back again after I go to permalinks->save.

Update 2:

I also tried clearing all transients. Did not help. I also tried completely removing the functions.php from the server and then uploading it again. Just to make sure it was loading a fresh file.

  • adding rewrite rules doesn't directly generate permalinks, the rules are for parsing incoming requests. to apply that pattern to a permalink requires a filter on post_link or similar. – Milo Mar 5 '14 at 18:13
  • I didn't mean to say that the rules are generating the links, but to point out that the links are wrong, despite the fact that I removed all rules. Anyway, I may have found the issue... – gdaniel Mar 5 '14 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.