Kulin Choksi
Kulin Choksi

Reputation: 761

How can I integrate wordpress in my website with common authentication?

A website is developed in core PHP with MySQL database. If we want to integrate Wordpress with that in such a way that we don't have to login in wordpress's wp-login page. Once we are login in core website, it should automatically login in wordpress. This mechanism should be applied to admin and front end too.

Upvotes: 3

Views: 879

Answers (1)

pp19dd
pp19dd

Reputation: 3633

You can perform this programmatically with PHP:

require_once( "wordpress/wp-config.php" );
$user = wp_signon( array(
    "user_login" => "username",
    "user_password" => "password",
    "remember" => true
), false );

// see if the call failed
if( get_class( $user ) == "WP_Error" ) {
    die( "oops- wrong user/pass?" );
}

It'd be up to you to synchronize or link usernames and passwords with your other system.

Upvotes: 3

Related Questions