Call plugin function from button and then forward
-
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: https://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.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Call plugin function from button and then forward’ is closed to new replies.