I am new to WordPress and have some doubts regarding structure.
I want to know that while writing database queries using $wpdb global variable, is it compulsory to put that code in function.php file and call that function where we required or we can write database queries in any file we required.
I need some detail information for using $wpdb variables and writing mysql queries. Is there any exact location for that ?
Thanks in advance.
Read more here: Which rules to follow while writing mysql queries in WordPress