Could you tell me why when I activate the plugin, error log is empty? I just want to catch the event of activation of the plugin (to create tables).
class International_Law {
public static function init_actions() {
register_activation_hook( $file = __FILE__,
$callback = array( 'International_Law' , 'activate' ) );
}
public static function activate(){
error_log("activate");
}
}
add_action( $hook_name = 'init',
$callback = array( 'International_Law', 'init_actions' ) );
Solved. The problem was that one can’t call register_activation_hook() inside a function hooked to the 'init'.
Doc: https://developer.wordpress.org/reference/functions/register_activation_hook/#more-information