[wp-hackers] $wp_rewrite->flush_rules() on plugin activation

scribu scribu at gmail.com
Fri Dec 11 19:35:16 UTC 2009


With the insights gained from this topic, I've managed to create a reusable
boilerplate class that sets up all the necessary hooks. You can then just
focus on the actual rules.

Here's the source code:

http://plugins.trac.wordpress.org/browser/scb-framework/trunk/classes/Rewrite.php


And here is a usage example (in a plugin):


class MyRewrite extends scbRewrite {

    function generate() {
        global $wp_rewrite;

        $wp_rewrite->add_rewrite_rule(...);
    }
}

new MyRewrite(__FILE__);


-- 
http://scribu.net


More information about the wp-hackers mailing list