How to check if we are in the init hook?

You can use did_action to test for this, e.g.: if ( did_action( ‘init’ ) < 1 ) { // init has not ran yet! Throw the exception } https://developer.wordpress.org/reference/functions/did_action/ did_action returns the number of times that action has been run. This can also be used to ensure it only happens once for filters that happen … Read more

Is there a hook that I can use when a fatal error occurs?

Look into the WP_Fatal_Error_Handler class. I see a couple of filters in its display_default_error_template() method that might be helpful for you: wp_php_error_args wp_php_error_message The entire class is a drop-in, so if you need to you can replace it entirely with your own version, but I think one of those filters—probably wp_php_error_args—might be what you’re looking … Read more

Hook function when taxonomy terms change

You can avoid infinite loop by removing the action before calling update post function. function maybe_disable_comment($post_id) { // do you check if the post has specific custom tax term. if ( ! has_term( ‘bar’, ‘YOUR_CUSTOM_TAX’, $post_id ) ) { return false; } // remove the filter that will create infinite loop. remove_action( ‘wp_insert_post’, ‘maybe_disable_comment’ ); … Read more

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