Fetching loged In user data in external PHP file
-
I want to fetch logged in user data in an external PHP file. The file contains PHP code that display records from MySQL table to frontend page.
When I try to include the wp-load.php file in my PHP file. PHP code stop showing data on the front page.
I am using this code to include wp-load.php file
require_once(rtrim($_SERVER[‘DOCUMENT_ROOT’], ‘/’) . ‘/wp-load.php’);
$current_user = wp_get_current_user();
$username=$current_user->user_login;My custom PHP file path is /api/advance.php
Looking for help from experts to solve this issue.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Fetching loged In user data in external PHP file’ is closed to new replies.