Hello friend, I waited for an update, but when it did not arrive, I edited the codes manually.
IndexNow v2.6.0: Manual changes…
wp-content\plugins\mihdan-index-now\src\Hooks.php
Replace line 35 with the code below or add // at the beginning:
//add_action( ‘wp_insert_comment’, [ $this, ‘comment_updated’ ], 10, 2 );
Add a new line between lines 35 and 36 and write this code:
add_action( ‘transition_comment_status’, [ $this, ‘comment_status_updated’ ], 10, 3 );
Lines 34,35, 36 and 37 should look like this:
add_action( ‘transition_post_status’, [ $this, ‘post_updated’ ], 10, 3 );
//add_action( ‘wp_insert_comment’, [ $this, ‘comment_updated’ ], 10, 2 );
add_action( ‘transition_comment_status’, [ $this, ‘comment_status_updated’ ], 10, 3 );
add_action( ‘saved_term’, [ $this, ‘term_updated’ ], 10, 3 );
Add the last code before the line below.
Line 106 : public function comment_updated( int $id, WP_Comment $comment ): void {
Add this codes::
public function comment_status_updated(string $new_status,string $old_status,WP_Comment $comment): void{
if($new_status!==’approved’){return;}
// Run only comment approved.
if($old_status===’unapproved’ and $new_status===’approved’){
// Delay.
$last_update = (int) get_comment_meta($id,Utils::get_plugin_prefix().’_last_update’,true);
if((current_time(‘timestamp’)-$last_update)<$this->ping_delay){return;}
do_action(‘mihdan_index_now/comment_updated’,$comment->comment_post_ID,$comment);
update_comment_meta($id,Utils::get_plugin_prefix().’_last_update’,current_time(‘timestamp’));
}
}
If you can’t do it, you can get the codes of the entire page ready-made here:
https://gist.github.com/NovaYear/52645febca60010f3ab124b4287e58a9