WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WP site and also have a external DB (means not WP DB) with users. The insertion process at that table uses the same algorithm as WP uses. What I'm need to do here is login in WP but using this external DB which is in the same host by the way. I check this links http://www.tyssendesign.com.au/articles/cms/connecting-to-external-database-from-within-wordpress/ and http://wordpress.org/extend/plugins/external-database-authentication/ and for the first is not what I'm want but for the second one is not compatible with WP 3+ and I'm using 3.3.1, any suggestion or docs or something else?

share|improve this question
up vote 2 down vote accepted

You can override the core wp_authenticate function.

You would need to create a custom plugin and declare a new version of wp_authenticate. The function accepts a username and a password and returns a WP $user object.

wp_authenticate is a 'pluggable' function and it is found in the wp-includes/pluggable.php file.

share|improve this answer
can this function work at functions.php in my theme? Also how to connect to an external DB and check in that for username and password? – ReynierPM May 23 '12 at 20:38
The function has to be in a plugin, it won't work in functions.php (has to do with how plugable functions are loaded in WP). – Roscius May 24 '12 at 13:23
You could use php mysql/mysqli functions to connect to the database to validate the username and password, the db connection would just be standard php db usage. It'd be good however to understand password hashing/salting processes to ensure best practices for password storage. – Roscius May 24 '12 at 13:26
Thanks @roscius I'll do that ;) – ReynierPM May 24 '12 at 19:42

I've just updated that old plugin for my needs. You can find the update @ http://www.7mediaws.org/extend/plugins/external-db-auth-reloaded

share|improve this answer

Have you tried the External Database Authentication plugin? Just because it hasn't been updated in a while doesn't mean it won't necessarily work. At the very least you can look at their source code to see how they did what they did and use that as a basis to get what you need done.

Here is the code http://plugins.trac.wordpress.org/browser/external-database-authentication/trunk/ext_db_auth.php

share|improve this answer
Yes I see that plugin but is a bit complex because I'm not a WP experts and a lot of things are new to me – ReynierPM May 23 '12 at 20:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.