How to Use WP_REDIRECT and Continue Parent Execution
I am overriding another plugins’ custom registration form with my own custom template (adding additional fields).
On submission, the original plugin triggers:
wc_add_notice( __( 'Your registration has been submitted successfully.', 'woocommerce-wholesale-pro' ) );
This renders in my own custom form submission, however I would like to:
- Re-direct the user back to the home page
- and then trigger the wc_add_notice() hook so that the success notice is displayed
I have completed 1) by adding the following:
wp_redirect(home_url());
exit();
However, now I am unable to see the original plugins wc_add_notice() hook be triggered/rendered on submission.
I am unable to grasp WordPress’s flow to achieve this task.
Is this possible? Any help/guidance would be greatly appreciated!
Please let me know if I can clarify anything from my end.
Leave an answer