I have my plugin all set-up using the Settings API and working but what I have is two manual functions in my plugin that can be run by the admin user by visiting the following URL's
<?php echo admin_url(); ?>options-general.php?page=wordpress-file-monitor-plus&sc_wpfmp_action=1&sc_wpfmp_scan=1 <?php echo admin_url(); ?>options-general.php?page=wordpress-file-monitor-plus&sc_wpfmp_action=1&sc_wpfmp_reset_settings=1
I'm using the
admin_init hook to lookout for these GET parameters and do those functions.
The functions run fine and the user is back on my plugin settings page but the GET parameters are still in the URL. Not a big issue but if the user then goes ahead and save the settings those GET parameters are sent again and thus running those functions again.
Why does the Settings API send those parameters when submitting the settings form? The action of the form is to submit to
The only way around my issue I can think of is that after those manual functions have run its code in
admin_init is to run a redirect to the settings page without the GET parameters, but if I do this I will lose my admin notices I'm trying to show to the user.
Anyway got any suggestions on how I can get around this problem. Maybe you think there is a better way to run these manual functions?
EDIT: full settings code: http://pastebin.com/Gk5RF5Lc