Discord Tunnel – WordPress Plugin
A powerful WordPress plugin that automatically publishes your posts and articles to Discord channels with rich embeds and complete customization options.
Features
- ✅ Automatic Publishing: Automatically post new articles to Discord when published
- ✅ Rich Embeds: Beautiful Discord embeds with title, excerpt, featured image, and author
- ✅ Channel Management: View and select Discord channels directly from WordPress admin
- ✅ Server Selection: Support for multiple Discord servers
- ✅ Custom Messages: Add custom messages alongside embeds
- ✅ Manual Control: Per-post control with meta box in post editor
- ✅ Error Handling: Comprehensive error reporting and retry mechanisms
- ✅ Responsive Design: Beautiful admin interface that works on all devices
Installation
- Download or clone this plugin to your WordPress
wp-content/plugins/ directory
- Activate the plugin through the WordPress admin panel
- Navigate to Settings > Discord Tunnel to configure the plugin
Discord Bot Setup
Step 1: Create a Discord Application
- Go to
https://discord.com/developers/applications
- Click "New Application" and give it a name
- Navigate to the "Bot" section in the left sidebar
- Click "Add Bot" to create a bot user
- Copy the bot token (you'll need this for the plugin)
Step 2: Configure Bot Permissions
- Send Messages – To post messages in channels
- Embed Links – To create rich embeds
- Attach Files – To include images
- Read Message History – To access channel information
Step 3: Invite Bot to Your Server
- In the Discord Developer Portal, go to the OAuth2 > URL Generator section
- Select the bot scope
- Select the required permissions listed above
- Copy the generated URL and open it in your browser
- Select your Discord server and authorize the bot
Plugin Configuration
Step 1: Enter Bot Token
- Go to WordPress Admin > Settings > Discord Tunnel
- Enter your Discord bot token in the "Bot Token" field
- Click "Test Connection" to verify the token works
Step 2: Select Server and Channel
- Click Load Servers to fetch your Discord servers
- Select the server where you want to post articles
- Click Load Channels to fetch available channels
- Select the specific channel for posting
Step 3: Configure Publishing Options
- Auto-Publish: Enable/disable automatic publishing
- Embed Style: Choose between rich embeds or simple messages
- Content Options: Include featured images and excerpts
- Custom Message: Optional message to include with posts
Step 4: Save Settings
Click "Save Changes" to store your configuration.
Usage
Automatic Publishing
Once configured, the plugin will automatically post new articles to Discord when you publish them in WordPress.
Manual Control
- Each post and page has a "Discord Publishing" meta box in the editor
- Enable/disable Discord publishing for individual posts
- View publishing status (success/error)
- See error messages if publishing fails
Rich Embeds
- Title: Post title with link to full article
- Description: Post excerpt or trimmed content
- Image: Featured image (if available)
- Author: Post author name
- Footer: Your site name
- Timestamp: Publication date
Troubleshooting
"Connection failed" error
- Verify your bot token is correct
- Check that the bot token hasn't been regenerated
- Ensure your server has internet connectivity
"Failed to load servers" error
- Make sure your bot has been invited to at least one server
- Verify the bot has proper permissions
- Check if the bot token is valid
"Failed to load channels" error
- Ensure the bot has "View Channels" permission
- Check that the selected server has text channels
- Verify the bot hasn't been kicked from the server
Posts not publishing
- Check that auto-publish is enabled
- Verify the selected channel still exists
- Look for error messages in the post editor meta box
Technical Details
Requirements
- WordPress 5.0+
- PHP 7.4+
- cURL extension enabled
- Internet connectivity for Discord API
API Rate Limits
- Maximum 50 requests per second
- Automatic retry with exponential backoff
- Error handling for rate limit responses
Security
- Bot tokens are stored securely in WordPress options
- All API requests use HTTPS
- Input sanitization and validation
- Proper nonce verification for AJAX requests
Hooks and Filters
Actions
discord_tunnel_before_publish - Fired before publishing to Discord
discord_tunnel_after_publish - Fired after publishing to Discord
discord_tunnel_publish_failed - Fired when publishing fails
Filters
discord_tunnel_embed_data - Modify embed data before sending
discord_tunnel_message_content - Modify message content
discord_tunnel_should_publish - Control whether a post should be published
Support
For support and updates, please visit the plugin repository or contact the developer.