Best Practices Reminder
WP plugin for sending periodic messages to Slack
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/mmilosevic87/random-slack-messages/archive/refs/heads/master.zipA WordPress plugin that sends a daily best-practice reminder to a Slack channel, cycling through posts in a round-robin queue.
What It Does
This plugin provides a simple system for delivering recurring tips, reminders, or best practices to your team via Slack:
- Custom Post Type — Registers a "Best Practices" post type in the WordPress admin where you create and manage your reminder messages
- Daily Cron Job — Every day, the plugin picks the post that was shown longest ago (round-robin rotation)
- Slack Delivery — Sends the selected post's content to a configured Slack webhook
- Queue Rotation — After a successful delivery, the post's timestamp is updated so it moves to the back of the queue
This means if you have 10 best-practice posts, each one will be sent roughly once every 10 days, cycling through all of them continuously.
How It Works
WP-Cron (daily)
│
▼
Pick oldest post ──► No posts? → Exit
│
▼
Send to Slack ──► Failed? → Exit (retry next run)
│
▼
Update timestamp (post moves to back of queue)
Each "Best Practices" post has a bpr_time meta field that records when it was last sent. The plugin queries for the post with the oldest bpr_time value, sends its content to Slack, and then updates the timestamp to now. Posts that fail to send are not rotated — they stay at the front of the queue and will be retried on the next cron run.
Benefits
- Automated team reminders — No manual effort after initial setup. Your team gets a daily best-practice tip in Slack.
- Round-robin delivery — Every post gets equal airtime. No duplicates until the full cycle completes.
- Failure-safe rotation — Posts only rotate after successful delivery, so nothing gets skipped silently.
- Easy content management — Add, edit, or delete reminders through the familiar WordPress post editor.
- Zero configuration UI — The only setup is adding the Slack webhook URL to
wp-config.php.
Requirements
- WordPress 5.0+
- PHP 7.4+
- A Slack workspace with an Incoming Webhook configured
Installation
-
Download or clone this repository into
wp-content/plugins/:cd wp-content/plugins git clone https://github.com/MMilosevic87/random-slack-messages.git -
Add your Slack webhook URL to
wp-config.php:define( 'SLACK_WEBHOOK', 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL' ); -
Activate the plugin in Plugins > Installed Plugins
-
Go to Best Practices in the admin sidebar and create your reminder posts
Usage
Adding Reminders
- Navigate to Best Practices > Add New in the WordPress admin
- Enter a title (for your reference — not sent to Slack)
- Enter the reminder text in the editor (this is what gets sent to Slack)
- Publish the post
How Rotation Works
- New posts automatically get a default timestamp that places them at the front of the queue
- The "BPR Time" metabox on each post shows when it was last sent
- The post with the oldest timestamp is always picked next
- After successful delivery, the timestamp updates to the current time
Monitoring
- Check the "BPR Time" metabox on any post to see when it was last sent
- Failed deliveries are logged to the WordPress error log (
wp-content/debug.logwhenWP_DEBUG_LOGis enabled)
File Structure
random-slack-messages/
└── rsm.php # Complete plugin — CPT, cron, Slack delivery, metabox
Configuration
The only required configuration is the SLACK_WEBHOOK constant in wp-config.php.
| Constant | Where | Description |
|---|---|---|
SLACK_WEBHOOK |
wp-config.php |
Your Slack Incoming Webhook URL |
Creating a Slack Webhook
- Go to api.slack.com/apps
- Create a new app (or select an existing one)
- Enable Incoming Webhooks
- Add a new webhook to a channel
- Copy the webhook URL and add it to
wp-config.php
Technical Details
- Cron schedule: Registered on plugin activation, cleared on deactivation
- Post selection:
WP_Queryordered bybpr_timemeta value (ascending), limited to 1 published post - Slack delivery: Uses
wp_remote_post()(WordPress HTTP API) with proper SSL verification - Error handling: Logs failures to
error_log(), does not rotate failed posts
License
GPL-3.0