This is my code, but it does not seem to work
function fep_cus_user_reply_comment_message($comment_ID) {
global $wpdb;
$comment = get_comment($comment_ID);
$comment_author_email = trim($comment->comment_author_email);
$parent_id = $comment->comment_parent ? $comment->comment_parent : '';
$author_name = get_userdata($comment->user_id)->display_name;
$notify = $parent_id ? get_comment($parent_id)->comment_mail_notify : '0';
$spam_confirmed = $comment->comment_approved;
if ($parent_id != '' && $spam_confirmed != 'spam' && $notify == '1') {
$wp_email = 'no-reply@' . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME']));
$author_id = get_comment($parent_id)->user_id;
if ($post->post_type !== 'works')//How to judge here? ? ?
return;
if ( ! function_exists( 'fep_send_message' ) )
return;
// Prepare message data
$message = array(
'message_title' => 'title', //change with message title
'message_content' => 'content', //change with message content
'message_to_id' => $author_id
);
$override = array(
'post_author' => 1, //change with message sender id
);
// Send message
fep_send_message( $message, $override );
}
}
add_action( 'comment_post', 'fep_cus_user_reply_comment_message' );