I need permalink to be set different from default after the plugin is activated I used get_option('permalink_structure') to check if permalink already set or not...
Here is the code block used in plugin activation function , I used class structure
if (get_option('permalink_structure'))
{
$this->setRewriteRules();
global $wp_rewrite;
$wp_rewrite->flush_rules(true);
}
and here is the serRewriteRules function
function setRewriteRules()
{
add_rewrite_rule('plugin-url/$', '/wp-content/plugins/my-plugin/page.php', 'top');
}
I searched a lot and update my code so many time but still not working for me ....