This is my first wordpress plugin and I’m running a lot of trouble making it work, it almost work fine but I don’t find a way to accomplish this specific thing.
Basically I’ve my custom setting page for my plugin, it saves all with no trouble at all, but the question its, how can I can my other button (inside the same setting page) to trigger, in this case, a sync action.
Because my plugin after configured it trigger another action that create/update records on a table, but the first time I need to run a sync to create/update the records from the old posts of the wordpress.
Edit:
Plugin source code on wsd-parse-api.
You need a second
form
withadmin_url('admin-post.php')
as form action. Then you can hook intoadmin_post_custom_action
to execute your action.Sample code:
In your settings page:
Update
Here is a rather extended example. It shows:
The example I have used here â updating an option â should not be used for plugins activated for on site only. For network activated plugins though this is quite useful, because there is no options API for those.
I should add comments, but I am too lazy. 🙂 I will write a blog post about this, and update the answer later with a link.