Using WordPress User Information Out of Directory

I have a PHP web application in which I want to use some user data from WordPress installed inside a folder.
Suppose My App is inside === →> www.example.com
and my WordPress installation is inside === →> www.example.com/membership .
Basically I will check if the user is registered in WordPress and uses some values
from the WordPress database to limit a few parameters in my web application.
I still need WordPress for Blogging, so think about how to use its user registration and Login module. Maybe?

+4
source share
1 answer

Yes it is possible. You can use wp in your application as follows:

<?php 
define('WP_USE_THEMES', false);
require(__DIR__'/membership/wp-blog-header.php');
if ( is_user_logged_in() ) {
    $current_user = wp_get_current_user();
}
?>
0
source

Source: https://habr.com/ru/post/1608966/


All Articles