Hi have a simple php file in my wordpress site, where I need the current userid I have tried the following, but keep getting
Call to undefined function get_current_user_id()
<?php
include '../../mydbfile.php';
global $wpdb;
// get current user ID, with default value, if empty
$current_user_id = get_current_user_id();
error_log('current_user_id '.$current_user_id);