wp_redirect to Settings Page
-
So I’ve got a plugin that I’ve created and on activation, I want to send the user from the plugin to it’s Settings page immediately.
Here’s the code I’ve got going:
function dbn_uaa_Plugin_Activated() { // some stuff unrelated to the problem goes here // redirect code follows: wp_redirect(admin_url('options-general.php?page=dbn-user-action-settings')); exit; } register_activation_hook(__FILE__, 'dbn_uaa_PluginActivated');When the
wp_redirectandexitcode are in there, none of the function actually functions. Strip it out, the unrelated stuff works fine. But with it there, I attempt to activate the plugin and the resulting URL for the settings page is correct, but I get a “Sorry, you are not allowed to access this page.” error.Strip out the redirect code and the plugin activates cleanly. And I can use the sidebar admin menu to navigate to the Settings page, successfully. I’ve compared the URLs generated by the redirect and by the sidebar menu and they are identical.
I also tried stripping out the redirect code and placing it in
class-dbn-uaa-activator.phpwith the exact same results as trying it with theregister_activation_hookcode/function shown above.What the hell am I missing here?
The topic ‘wp_redirect to Settings Page’ is closed to new replies.