[wp-hackers] Regenerating re-writes upon migration

David Anderson david at wordshell.net
Wed May 15 12:13:43 UTC 2013


To answer my own question from yesterday...

If you're doing an online replacement (i.e. from within WordPress 
itself) of your own database from another webserver, and want to do a 
best-effort job of regenerating your (possibly non-existent) .htaccess 
file to take account of the possibly different permalink structure in 
the database being imported, then...

This is sufficient:
         global $wp_rewrite;

Only other thing is that you'll need to hook the the pre_option_ filter 
for the options permalink_structure, rewrite_rules and page_on_front 
options in order to make sure that WordPress gets the data from your 
newly-migrated database instead of from cached settings.


WordShell - WordPress fast from the CLI - www.wordshell.net

More information about the wp-hackers mailing list