How can I receive an email notification when a specific change happens on WordPress?

You are here:
Back

Use the Email Notifications module in the WP Security Audit Log plugin to receive an email notification when a specific change happens on WordPress. The concept of configure email notifications is very simply: configure the trigger, which is like the criteria to check for a specific change, and when that trigger is triggered the email is changed.

This document explains how to configure an email notification trigger in just two steps.

1. Find the Alert ID of the WordPress Change

The WP Security Audit Log plugin uses a different Alert ID for every different change or action on WordPress. For example whenever a user logs in, the ID of the alert in the WordPress activity log is 1000. Use the search in the list of WordPress activity log alert IDs to find out the change you’d like to be notified about.

For this example we are going to configure an email alert for when a user with the role of Editor publishes a post. So the first thing I need to do is find out what is the Alert ID of when a user publishes a post. As seen in the below screenshot I searched for the term publish in the list of Alert IDs, and in the results I can see that alert ID 2001 is used when a post is published.

Searching for a specific WordPress activity log alert ID

2. Create the Email Notification Trigger

Configuring a WordPress email notification trigger

Now that we know the Alert ID we just have to create the email notification trigger seen in the above screenshot. To create a new email notification trigger:

  1. Click on the Email Notifications node in the plugin menu and click the Add New button.
  2. Specify a title for the trigger. In our example we are using Editor published post.
  3. Click the + Add Trigger button.
  4. Configure the following criterion: ALERT CODE IS EQUAL 2001.

Note: if you configure the above trigger the plugin will send an email whenever a new post is published, though we want to receive an alert when an editor publishes a post, so we have to configure another criterion in the trigger.

  1. Click the +Add Trigger button to add the second criterion.
  2. Configure the following: AND USER ROLE IS EQUAL EDITOR.
  3. Specify the email address(es) you’d like to alert and click Add Notification to save the trigger.

More advanced trigger criteria

You can use several different trigger types to build more complex criteria. For example you want to be alerted via email when an editor publishes a movie (which is a custom post type). In such case you can built a trigger such as the below:

ALERT CODE IS EQUAL 2001 AND USER ROLE IS EQUAL EDITOR AND POST TYPE IS EQUAL Movie

You can read more about grouping email notification triggers & using operands in the Getting started guide for WordPress email notifications.