Count when a post of a custom post type is deleted and store it in a theme option

The hook played by WordPress just before a post is “definitively” deleted is https://developer.wordpress.org/reference/hooks/delete_post/

+the comment left by @tom-j-nowell.

Regards

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