I am trying to get some data from WordPress database tables in a plugin. For that, I am using the below code...
global $wpdb;
$findID = $wpdb->get_var("SELECT ID FROM wp_posts WHERE post_name = 'hello-world'");
echo $findID;
But it not giving me the post ID in echo
? Is there anything wrong...???