Plugin Options Saving Issue
-
I created a custom plugin option
In Plugin Option,
API Token: ____________ (text field)
I want to run a function after save not when the page is loaded.
/* register plugin settings */ function ptgoalserve_registersettings_fnc() { /* plugin options pt_livescore_plugin_options @option_group = ptgoalserve_plugin_options */ register_setting('ptgoalserve_apidetails','ptgoalserve_plugin_options'); /* sections API Settings @ptgoalserve_apidata section */ add_settings_section('ptgoalserve_apidata', __( 'Goalserve.com API Data', 'ptgoalserve' ), 'ptgs_section_token_cb', 'ptgoalserve' ); /* setting field for API Data */ add_settings_field( 'ptgoalserve_token', __( 'API Token', 'ptgoalserve' ), 'ptgoalserve_apitoken_cb', 'ptgoalserve', 'ptgoalserve_apidata' ); } add_action('admin_init','ptgoalserve_registersettings_fnc');
I want to run a function that will import data after save.
The use of the function is to import data from our API and insert it to our custom table database.
function ptgoalserve-importdata() { //the code here to insert global $wpdb; /// blah blah }
I tried the update_option() or the update_option_ptgoalserve_plugin_options or updated_option_ptgoalserve_plugin_options but it doesn’t work after saving.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Plugin Options Saving Issue’ is closed to new replies.