How To Consistently Enforce Rewrite Rule in Plugin Development

Here’s a solution. See comments at the end… // I am a functions.php file of a plugin called “sample” — implement me slightly differently for a theme. // Note this code requires WP 3.0 or greater. class SAMPLE { public static function activatePlugin() { self::rewriteURL(); flush_rewrite_rules(); if (get_option(‘permalink_structure’) == ”) { self::updatePermalinks(); } // add … Read more