I read from another question and tried their code which is pasted below - Update post date on every new comment?
This code is working well, however it updates the time when people Insert Comment in the front-end. What I seek is to update the time when admin Approve Comment in the back-end.
I read in another question and tried to replace with the hook suggested, but with no success - Approve comment hook?
add_action('wp_insert_comment','update_post_time',99,2);
function update_post_time($comment_id, $comment_object) {
// Get the post's ID
$post_id = $comment_object->comment_post_ID;
// Double check for post's ID, since this value is mandatory in wp_update_post()
if ($post_id) {
// Get the current time
$time = current_time('mysql');
// Form an array of data to be updated
$post_data = array(
'ID' => $post_id,
'post_modified' => $time,
'post_modified_gmt' => get_gmt_from_date( $time )
);
// Update the post
wp_update_post( $post_data );
}
}