Skip to content

Instantly share code, notes, and snippets.

View stephenafamo's full-sized avatar

Stephen Afam-Osemene stephenafamo

View GitHub Profile
@stephenafamo
stephenafamo / programmatic_login.php
Created July 9, 2016 09:30 — forked from iandunn/programmatic_login.php
Programmatically log in a WordPress user
/**
* 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();