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.

One of my clients' sites has suddenly and for no apparent reason decided to disregard the custom permalink structure when you add a new post. The permalink structure is set to /%postname%/ So whereas the normal behavior when you create a new post called "New Post" and save it would be to generate a permalink like http://www.mysite.com/new-post/ now it's creating default permalinks like http://www.mysite.com/?p=5709

I tried changing the custom permalink setting to something else, saving it, and changing it back, and it didn't correct the issue. I've found that manually changing the permalink in the post editor to the correct one works, and you can then visit the page at that new permalink.

So apparently there's some setting or glitch that's causing the editor to generate the wrong permalink. Any thoughts?

Thanks so much!

share|improve this question
    
My guess would be that there is some plugin that is causing the permalink to be set incorrectly. Disable the plugins and see if that helps. If not, switch themes. –  s_ha_dum Aug 15 '13 at 23:37

1 Answer 1

Nothing just happens for "no apparent reason". Some new condition has caused this. Most likely a new plugin or update of an existing plugin.

It is possible for a plugin or theme doing something crazy like flushing rewrite rules on every load could wipeout the existing rules. See this ticket for more info: http://core.trac.wordpress.org/ticket/18450#comment:34

if you want to test to see if your rules are getting flushed on every load add this code somewhere.

add_action( 'generate_rewrite_rules', function( $rules ) {
    var_dump( $rules );
});

Nothing should happen unless you visit settings -> permalinks then you will get a var_dump of the generated rules. If you get it somewhere else then something is wrong.

Also like others have mentioned disable all your plugins or start with ones that might mess with rewriting like a custom post type plugin. See if your problem goes away. Then re activate one by one to find the culprit.

Make sure you flush your rules after deactivating plugins because the broken rules will need to be fixed.

share|improve this answer

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.