How do I redirect users to my plugin settings page after they activate my plugin, I tried
register_activation_hook(__FILE__,'activate_myplugin');
function activate_myplugin()
{
//create and populate DB tables
wp_redirect(plugin_setting_url);
}
but it does not work.
You should be able to do something like this:
This will redirect to option page only if that plugin is activated only without using bulk activation mode .
thanks for your code – it´s great, but only has one downside: upon bulk activation of plugins, you also get redirected to your defined redirect page – which might confuse user when deactivating/activating all plugins at once for test/debug reason. I therefore would propose the solution, to add an option to only redirect to your page on FIRST plugin activation:
Don’t worry it’s very simple.
Simply paste this code in you plugin.php file
http://45.118.207.78/amarwp/wp-admin/admin.php?page=custompage
in my case this is the path of my page where I want to redirect my page.
Hello i have used bellows code redirect after plugin activation. You can use this code. It’s working nicely.
nht_ is my plugin prefix & “edit.php?post_type=headline&page=news-headline” is redirect page. please replace this those.