How to trigger function on theme delete?

As long as you don’t delete your theme by ftp, but use the regular way of switching to another theme in the admin, there is a hook to use, switch_theme. It works like this:

add_action('switch_theme', 'mytheme_setup_options');

function mytheme_setup_options () {
  delete_option('mytheme_option1');
  delete_option('mytheme_option2');
}

There’s a sister hook called after_switch_theme, which you could use, for instance, to load default options when a theme is switched on.

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