WordPress
Monitor your WordPress site events (logins, registrations, errors, etc.) directly in AlertHub. The official AlertHub plugin lets you configure alerts for any WordPress hook without writing code.
Installation
Install AlertHub from the WordPress.org plugin directory.
- Log in to your WordPress Admin Dashboard.
- Go to Plugins > Add New.
- Search for AlertHub.
- Click Install Now, then Activate.
You can also open the plugin page directly: wordpress.org/plugins/alerthub.
Alternative: WP-CLI
wp plugin install alerthub --activate
Configuration
Once activated, you need to connect the plugin to your AlertHub project.
-
Get your Project Key:
- Go to your AlertHub Project Settings.
- Copy your One-Way Secret Key.
-
Enter Credentials:
- In your WordPress Dashboard, go to Tools > AlertHub.
- Paste your Project Key in the corresponding field.
- (Optional) Set a Shared Source Name (e.g., “My Blog”). This helps identify alerts if you manage multiple sites.
- Click Save Settings.
-
Test the Connection:
- Click the Send Test Alert button.
- Check your AlertHub dashboard (and any connected channels like Slack/Teams) to confirm you received the test alert.
Creating Alerts
You can create custom alerts for any WordPress action hook.
- Go to Tools > AlertHub > Alerts.
- Click Add New.
- Active: Ensure the alert is enabled.
- WordPress Hook: Select a preset (e.g.,
wp_login_failed,user_register) or type any valid WordPress hook name (e.g.,woocommerce_payment_complete). - Title & Description: Define what the alert should say. You can use valid placeholders if the hook passes arguments (advanced usage).
- Level: Choose between Info, Warning, or Error.
- Click Save Alert.
Advanced: Using Placeholders
You can use dynamic data from the WordPress hook in your alert title and description using {{mustache}} syntax. The placeholder {{0}} access the first argument passed by the hook, {{1}} the second, and so on. You can also access object properties like {{1.post_title}}.
Example: Failed Login Alert
When a login fails, WordPress triggers the wp_login_failed hook, passing the username as the first argument that means the placeholder {{0}} will be the username.
- Hook:
wp_login_failed - Title:
Failed Login: {{0}} - Description:
Someone tried to log in as **{{0}}** but failed. - Level:
Warning
This will result in an alert like: “Failed Login: admin”.
You can check the complete list of WordPress hooks and the arguments they pass to understand how to use placeholders.
Logs
The plugin keeps a local history of sent alerts for debugging purposes.
- Go to Tools > AlertHub > History.
- You can see the status, payload, and response of the last alerts sent.