Debugging Technique Question re: functions.php

There isn’t really a prescribed way to do this, but it’s probably safer to hook an action like init to be sure everything you need is loaded, and then maybe check for some sort of flag so you can control which page loads run your code.

function my_test_func(){
    if( isset( $_GET['do_my_test_thing'] ) ){
        // your code
    }
}
add_action( 'init', 'my_test_func' );

Then add ?do_my_test_thing=true to the URL to explicitly run your code on that page load.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)