'$wpdb->get_results shows and empty array
I am trying to get some data form wordpress db and it somehow gives me back an empty array. When I am trying this query below I receive the whole details and it is working perfectly.
$query = $wpdb->prepare("SELECT * FROM $wpdb->usermeta");
But when trying this query below it gives me back an empty array like this: array(0){}
$user_data = get_userdata($current_user_id); // get current user data by id
$user_url = $user_data->user_url; // get current user url
$user_url = substr($user_url, 6);
global $wpdb;
$query = $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_value = %s", $user_url);
echo $query;
$results = $wpdb->get_results($query);
var_dump($results);
Please help me, I am trying to figure it out without any success...
Solution 1:[1]
user_url is a column in the wp_users table. It's not in the metadata table.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | O. Jones |
