You can hook the ‘comment_notification_text’ filter and edit or replace the text that way. You can also copy the entire wp_notify_postauthor() function declaration (on wp-includes/pluggable.php) to your child theme and directly edit that version as needed. Your version will be used in place of the original.
Thread Starter
simon
(@simonp820)
Thanks bcworkz – I tried the latter but get:
Fatal error: Cannot redeclare wp_notify_postauthor() (previously declared in /home/ukwebhos/public_html/wp-includes/pluggable.php:1243) in /home/ukwebhos/public_html/wp-content/themes/wprs-awh/functions.php on line 223
Oh right, you get that when you activate a plugin because the other function is already defined during activation. You need to include the if ( ! function_exists('wp_notify_postauthor')): line and the corresponding endif; at the bottom.
Your version will not load when the plugin is activated, but it will subsequently be used when someone adds a comment due to the loading order of the pluggable.php file being after activated plugins.
OR, if you put your version in functions.php of your theme, you’ll have to move it to a plugin, themes load too late to override pluggable.php. If you haven’t yet created a site specific plugin to contain all of your custom hacks, now is a good time to start one 🙂
I should have mentioned this initially, sorry for the oversight. I usually add pluggable functions to my already activated site specific plugin so never encounter this issue.