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

Does WP identify plugin by plugin name or plugin_basename?

Plugins are identified by the path to the file containing the plugin headers. For instance the debug bar plugin would be identified as: debug-bar/debug-bar.php See activate_plugin To add an action on activation you need to register the hook using register_activation_hook( $file, $function ) example: register_activation_hook( __FILE__, ‘activation_function’ );