A fresh mix of code snippets and tutorials

WordPress plugin redirect when settings saved

This technique is a bit esoteric and mostly for my own reference. Feel free to try the code if it makes sense to you; otherwise, maybe just move on to the next code snippet. Just not enough time in the day to explain everything.

You’ll either understand this code or you won’t ;)

add_menu_page('Example', 'Example', 'manage_options','example_settings_page',  array($this, 'example_settings_page'));
add_action('admin_action_example_settings_page', array($this, 'example_settings_page'));

..and then in the form itself:

<form method="post" action="<?php echo self_admin_url('admin.php'); ?>" enctype="multipart/form-data">
	<input type="hidden" name="page" value="<?php echo $_REQUEST['page'];?>">
	<input type="hidden" name="action" value="example_settings_page">

Note that example_settings_page is the common denominator.

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress