Skip to content

Instantly share code, notes, and snippets.

@michaelaguiar
Created March 23, 2013 18:29
Show Gist options
  • Save michaelaguiar/5228879 to your computer and use it in GitHub Desktop.
Save michaelaguiar/5228879 to your computer and use it in GitHub Desktop.
Wordpress XMLRPC Authentication from external app
<?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