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

Say I have a non-Wordpress website abc.com that has a Wordpress install at abc.com/news.

How can I integrate my non-Wordpress login system at abc.com with the Wordpress installation at abc.com/news so that if a user logs into abc.com and then browses to abc.com/news he is already logged in at abc.com/news?

share|improve this question

Not tested, but try to do a post request via ajax. The file you call via ajax should look something like this:

require( dirname(__FILE__) . '/wp-load.php' );
$user = filter_input( INPUT_POST, FILTER_SANITIZE_STRING );
$pass = filter_input( INPUT_POST, FILTER_SANITIZE_STRING );
            ) ? die( -1 ) : die( 0 );

Put this code in a file (e.g. ajax-login.php) and call it vai ajax. Then WordPress should set a cookie to grant access.

share|improve this answer

There are two basic methods that you can tackle this with

  1. Let wordpress handle all the user login/logouts and load wordpress's core to check user login logout
  2. Let the other system handle its own login, then have wordpress check for the (proerply formatted) $_SESSION or $_COOKIE variable and log the user in based on this.

Potential problems: With solution one you're looking at adding a lot of overhead (namely loading wordpress) to just do user management, but it is probably the more robust solution. With solution two you're gonna hit issues when you go to logout, especially if you want to logout of wordpress, but not the other user system.

share|improve this answer
can you explain this by giving code example .? – user1138383 Jan 25 '12 at 10:45
Which one would you like explained? I can do pseudocode, don't have time for much else (sorry) – mor7ifer Jan 25 '12 at 18:52

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.