Advertisement
raselahmed7

Redirect to settings page after activating your plugin

Jul 25th, 2014
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. register_activation_hook(__FILE__, 'my_plugin_activate');
  2. add_action('admin_init', 'my_plugin_redirect');
  3.  
  4. function my_plugin_activate() {
  5.     add_option('my_plugin_do_activation_redirect', true);
  6. }
  7.  
  8. function my_plugin_redirect() {
  9.     if (get_option('my_plugin_do_activation_redirect', false)) {
  10.         delete_option('my_plugin_do_activation_redirect');
  11.         if(!isset($_GET['activate-multi']))
  12.         {
  13.             wp_redirect("options-general.php?page=wcf-settings");
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement