- Undefined variable $ID: You’re using
$IDvariable inget_permalink()andget_edit_post_link()functions, but it’s not defined anywhere in your code. You should replace it with$post->ID.n - Incorrect function name: You’re using
wp_mail_to()instead ofwp_mail()to send the email. - Overwriting variables: You’re overwriting the
$messagevariable. Instead, you should concatenate the message strings. - Headers issue: You’ve initialized
$headersas an empty array, but it should contain the actual headers for the email, such as From, Content-Type, etc.
amir
fgfgfg