Need a method for base_url() or home_url() in additional settings
-
on_sent_ok: “location.replace(‘https://www.mywebsite.com/pageid’)” Works well in additional settings but I need to make my website more portable. I would like to use a function to call base_url() or home_url(). Instead of writing out http://www.mywebsite.com/pageid, I would rather use on_sent_ok: “function(‘pageid’).”
I have tried adding a JS to the page template:
<script type="text/javascript"> function PgRedirect($pageid) { var url='' url= "<?php echo home_url($pageid)?>"; window.location = url; </script>
This does not work. I have tried adding a function to functions.php:
function wpcf7_pg_redirect($pageid){ wp_redirect(home_url($pageid)); exit(); } add_action('wpcf7_mail_sent', 'wpcf7_pg_redirect');
This does not work either. I am not sure what I am missing here. Any tips would be appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Need a method for base_url() or home_url() in additional settings’ is closed to new replies.