How to logout from wordpress without using wp-login.php?

We completely disabled the wp-login.php for security reasons.

But we would like to allow users to log out, but this requires the wp-login.php

Read More

So how could we write our own logout page that does not involve using wp-login.php ?

Related posts

Leave a Reply

1 comment

  1. Just have a page – like wp-logout.php – that runs session_destroy()
    or better yet, wp_logout() (wp manual)

    Albeit, I should offer an alternative to completely disabling that…

    You could, for example, have a whitelist of IP’s – and in your wp-login.php have:

    if(!in_array($_SERVER['REMOTE_ADDR'], explode("n",file_get_contents('whitelist.lst'))){
     header("Location: http://yourpage.com"); exit(); 
    }
    

    Alternatively, you could just store the whitelist in an array that comes right before that…

    $whitelist = array("123.456.789.100", "98.87.65.54"); //etc