I have added this function to rewrite some rules in wordpress:
add_action( 'init', 'my_add_rewrite_rules' );
function mydid_add_rewrite_rules() {
global $wp_rewrite;
add_rewrite_rule(....);
.... Added some rewrite rules here...
$wp_rewrite->flush_rules();
}
So far, everything works perfect.
After browsing the urls, I supposed that the database containing the rewrite rules was updated and I have commented the line:
// commented the line because this is an "expensive" action and I suppose that the
// database is already updated
// $wp_rewrite->flush_rules();
However, after commenting, the url rewrite does not work. Why? Wasn't the database already updated?
p.s. I can not flush from the wp admin panel because of some theme's constrains...
Thanks
Ok, found the problem...
There was another "flush rewrite rules" somewhere else, which actually overriden the database. I commented it as well and everything works fine now.