Support » Plugins and Hacks » Must call $wp_rewrite after update_options(‘permalink_structure’) ???

Must call $wp_rewrite after update_options(‘permalink_structure’) ???

  • After calling an update_option(‘permalink_structure’, ‘/%postname%/’) via script in functions.php, is it necessary to then call a $wp_rewrite as indicated below?

    // Flush rules to pick up the new page.

    If so, it the purpose of the rewrite to insure that the .htaccess file gets updated?

    I ask this because just after executing the function, my pages return 404’s even though the permalinks_options.php reports that the permalink is indeed set to custom: ‘/%postname%/’)

    However, I have to manually hit “Save Changes” on the permalink options page to make it stick. I’m wondering if the fix is to add the rewrite code above, or am I missing something?

Viewing 2 replies - 1 through 2 (of 2 total)
  • wp_rewrite does not appear to have any effect. Users still have to manually click “Save Options” on the permalinks screen.

    I suppose I will run firebug on that page during the update to see what’s getting set that update_options is apparently missing.

    This would appear to be a bug in update_options when the option being updated is permalink_structure.

    Anyone disagree?

    I’m thinking your error was in setting the option directly in the database rather than using the


    function as documented here


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Must call $wp_rewrite after update_options(‘permalink_structure’) ???’ is closed to new replies.
Skip to toolbar