私のメールが送信された後にリダイレクトする方法が不思議です。私はjavascriptでそれをやろうとしましたが、header("Location: "www.google.com"")
でも試してみましたが、これはうまくいきません。誰かが私を助けてくれることを願っていますこれは私のコードです:メールの送信後にどのようにリダイレクトするのですか(wp_mail)?
<script>
var text;
function show(param_div_id,button) {
<?php
if(isset($_POST['reset'])) {
$headers = "MIME-Version: 1.0" . "\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$result = str_ireplace("undefined" , "" , $_POST["ll"][0]);
$email = $_POST["ll"][1];
wp_mail("[email protected]", "email","Dear, <br><br>".
"From test filled in by " .$email. " this came out: <br><br>".
$result. "<br><br> Greetings, <br> website.nl"
,$headers);
}
?>document.getElementById('main_place').innerHTML = document.getElementById(param_div_id).innerHTML;
text = text + " " + button;
var ll=document.getElementById('ll');
ll.value=text;
console.log(button)
}
</script>
<?php
}
私は電子メールを送信した後、ありがとうございましたページに行くのが大好きです。
JavaScriptのリダイレクトを試してみましたか? – CumminUp07
wp_mailの後とif(isset($ _ POST ['reset'])) –
の後に、wp_redirect( '"/ thank-you-page"、int $ status = 302)https://developer.wordpressを使用できます.org/reference/functions/wp_redirect/ – VA79