Skip to main content
1 of 2
Steve
  • 123
  • 6

Issue plugin commands in admin settings page

What is the right way to issue commands in wp-admin? My plugin imports data from a set of RSS feeds via a cron job. Thats all working good. I've set up a custom settings page to change parameters, and wanted to add an "Update Now" button so the user could force a manual refresh. I need a few other commands as well.

What is the "wordpress way" to add and handle these commands?

I tried adding a url http://example.com/wp-admin/options-general.php?page=myplugin&action=update to the options page, then

if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') { doUpdate(); }

but i get an error showing $wp has not been initialised. I tried including the wp-load.php and the wp-settings.php but it didn't help.

What am I doing wrong? How can I allow the user to perform an action from an admin settings pane?

cheers

Steve
  • 123
  • 6