Skip to content

Instantly share code, notes, and snippets.

View thuijssoon's full-sized avatar

Thijs Huijssoon thuijssoon

  • The Netherlands
View GitHub Profile
/**
* Programmatically logs a user in
*
* @param string $username
* @return bool True if the login was successful; false if it wasn't
*/
function programmatic_login( $username ) {
if ( is_user_logged_in() ) {
wp_logout();