How to create logout page with session in wordpress?

Create logout page with session in wordpress

<?php

session_start();

session_destroy();

session_unset();

//echo ‘<script LANGUAGE=”JavaScript”>window.location.href=”‘.site_url().'”;</script>’;

if(!isset($_SESSION[‘ID’])){

 echo ‘<script LANGUAGE=”JavaScript”>window.location.href=”‘.site_url().’/login-form”;</script>’;

}

?>

<script>

    location.reload();

</script>

Leave a Reply

Your email address will not be published. Required fields are marked *