I am desperately attempting to find a way to get an alert when a specific article on my WordPress is visited (and no, I will not be flooded by emails, the code will be used temporarely) Being new to php, I used this code, but the site gets a critical error if I put it into the functions.php?
function email_alert() {
wp_mail( 'aprilia@example.net', 'Alert', 'This Site was Visited!' );
}
if(is_article(1234)){
}
add_action( 'wp', 'email_alert' );
please help/advice, a big thank you!