Query Column of Specific ID from Database Table
You have 2 two problems here: – You can’t use $wpdb-> with custom tables because [postmeta, posts, …] are variables in the class $wpdb. – WHERE ‘id’= 2 is not correct WHERE id = 2 So it should work: global $wpdb; $table_name = “_customtable”; $retrieve_data = $wpdb->get_results( “SELECT * FROM $table_name WHERE id = 2” … Read more