What's wrong with this query? It always returns NULL.
$recipes = $wpdb->get_results(
"SELECT ID FROM ".$wpdb->posts." WHERE post_author = %d AND post_status IN ('draft','publish') AND post_type = 'recipes' ", $current_user->ID
);
What's wrong with this query? It always returns NULL.
$recipes = $wpdb->get_results(
"SELECT ID FROM ".$wpdb->posts." WHERE post_author = %d AND post_status IN ('draft','publish') AND post_type = 'recipes' ", $current_user->ID
);
get_results takes output type as second parameter. You're missing prepare method if you want to do it like this. It should be something like
$recipes = $wpdb->get_results($wpdb->prepare ("SELECT ID FROM ".$wpdb->posts."
WHERE post_author = %d
AND post_status IN ('draft','publish')
AND post_type = 'recipes' ", $current_user->ID));