Created
March 23, 2013 18:29
-
-
Save michaelaguiar/5228879 to your computer and use it in GitHub Desktop.
Wordpress XMLRPC Authentication from external app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('xmlrpc_methods', 'wpse39662_add_login_method'); | |
function wpse39662_add_login_method($methods) | |
{ | |
$methods['wpse39662.login'] = 'wpse39662_check_login'; | |
return $methods; | |
} | |
function wpse39662_check_login($args) | |
{ | |
$username = $args[0]; | |
$password = $args[1]; | |
$user = wp_authenticate($username, $password); | |
if (is_wp_error($user)) { | |
return false; | |
} | |
return true; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment