Ello there.
I'm new to WordPress plugin development (new to Php in general) and I'm looking for my plugin to run some if checks and then forward to a new page after a submit/button was clicked.
I am currently running something like:
function plugin_run_function() {
if (isset($_POST['button-name']))
if (something == true) {
header("Location: http://my.com/forumpage/");
}
}
}
add_action('init', 'plugin_run_function');
My questions are:
how can I call the function on a button click (does add_action('init', 'plugin_run_function') work)?
how can I redirect to a new page (wp_safe_redirect();)?
Currently I'm just learning so security and OOP style plugin will come later on.
Thanks in advance for the help.