There is a website on wordpress. There is a mysql database, it has a table with logins / passwords + more fields that work with the program on the computer. How to fasten this database or table to the site? so that when authorizing a user, the site takes a login / password from another database / table?

  • WP has its own principle of coding passwords with prefixes, etc. In your case, you can create users with the same logins and access the necessary second-base lines comparing logins. You can connect the second base in WP like this: $wpdb2 = new wpdb( 'user', 'pass', 'name_bd', 'IP-server' ); - Sergey Strelchenko

1 answer 1

Use the filter in functions.php .

 add_filter( 'authenticate', 'filter_auth', 10, 3 ); function filter_auth( $user, $username, $password ){ // Проверьте имя и пароль по своей базе // Если успешно, надо создать объект WP_User и присвоить его переменной $user // Если неуспешно, надо создать объект WP_Error и присвоить его переменной $user return $user; }