• Resolved TheXrion

    (@negarehgfx)


    Hello
    I need to removing User email in New comment notification emails that sends to post author. But when we removing That line in notification email after updating wordpress the line will be add again Naturally.

    How can remove it ? and new WordPress Updates not able to affect our changes?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    To protect code modifications, you must either create a child theme or a plugin. To manually create a site specific plugin which could contain any other custom code as well, first come up with a good, unique name. I often use “custom-” followed by some variant of the site’s domain name. Create a folder with that name in /plugins/ to contain your new plugin.

    Start a new .php file named after your plugin. Add header content. Save the file and upload to the folder you created in plugins. Log into the site and activate the plugin.

    OK, cool, but our plugin doesn’t do anything! Add a filter hook. Hooks are how we alter how WP operates without needing to alter core code. To alter author comment notifications, use the ‘comment_notification_text’ filter. Your callback could check the post author’s capabilities. If the post author has editor or admin capabilities you may not want to remove email data.

    Either way, search (with preg_replace()) for “/Email: .*\s/” and replace with an empty string. Return the modified text.

Viewing 1 replies (of 1 total)
  • The topic ‘Removing User Email for author comment notification’ is closed to new replies.