送信時に「ありがとうございました」ページをリダイレクトして開くフォームがありますが、誰もこのページに URL でアクセスできないようにしたいと思います。このページは、フォームのリダイレクトからアクセスできる必要があります。問題は、からやろうとしたのですが、うまくいき.htaccess
ません。
現在の URL:mySite.com/thank-you
次のようにマスクしたいと思います。mySite.com/
function.php で次のコードを使用しました。
/**
* Form ---> Thank you page
*
*/
add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '6881' == event.detail.contactFormId ) { // Sends sumissions on form idform to the thank you page
location = '/thank-you/';
} else { // Sends submissions on all unaccounted for forms to the third thank you page
// Do nothing
}
}, false );
</script>
<?php
}
それを可能にする方法がわかりません。誰か助けてくれませんか?