Plugin Redirect After Activation

You add this as your activation hook:

    register_activation_hook(__FILE__, 'srpt_plugin_activate');

but the function is my_plugin_activate not srpt_plugin_activate. This is based on the fact that there is no function srpt_plugin_activate, and looking at the code my_plugin_activate fills its place in the flow. Is this a typo in the question or in the live code?

Plus, re your 245 characters of unexpected output. You are creating no output intentionally before the redirect? So you must be getting an error message, possibly PHP warning or notice level, and that is giving you the 245 characters of unexpected output. I do not know why your options page url would end in .php my plugins always create their options pages using add_submenu_page and I define a string to use as the page name, and then the url for the page is for example: /wp-admin/admin.php?page=the_string_i_gave. Here is an example of me adding an options page to one of my plugins:

add_submenu_page('wswpsubscriber', __('Main Management Area','WsWpSubscriber'), __('Options','WsPsSubscriber'),'manage_options','wswps_setup',array(&$this,'subscribe_main_menu'));

function subscribe_main_menu

then controls the output for the page found at /wp-admin/admin.php?page=wswps_setup

Leave a Comment