Site icon Hip-Hop Website Design and Development

Catch the moment when theme is deleted

WordPress 5.8.1

functions.php

add_action( 'deleted_theme', 'nonverbis_delete_extra_table', 10, 2 );
function nonverbis_delete_extra_table( $stylesheet, $deleted ){
    error_log("delete_extra_table", 0);
}

What I do:

The log is empty. I mean that everything that this function does is writing "delete_extra_table" to the log. I don’t have a debugger, so, I use writing to log for the debug purpose.

But the log is empty. This means that either a hook is wrong. Or some params (10, 2). Or I confused something else (like log or something).

To the best of my understanding, this line should have appeared in the log after I had pressed "Delete".

Could you help me understand why nothing has been written to the log?

And of course, the table has not been dropped.