A professional WordPress plugin that integrates AI-powered bots into bbPress forums with multi-provider support (OpenAI, Anthropic, Google Gemini, Grok, OpenRouter).
- Multi-Provider AI Support: OpenAI, Anthropic, Google Gemini, Grok, OpenRouter
- AI-Powered Search: AI intelligently determines and executes search queries for relevant context
- Smart Bot Triggers: Responds to @mentions, keywords, and forum restrictions
- Forum Access Control: Restrict bot to specific forums with hierarchical selection
- bbPress Integration: Full compatibility with bbPress notifications, points systems, and activity feeds
- Remote Content Integration: Query external WordPress sites via BBP Bot Helper plugin
-
Requirements:
- WordPress 5.0+
- PHP 7.4+
- bbPress plugin installed and activated
- API key from supported AI provider
-
Install Plugin:
# Via WordPress admin Plugins > Add New > Upload Plugin > Select ai-bot-for-bbpress.zip # Via WordPress CLI wp plugin install ai-bot-for-bbpress.zip --activate
-
Configure Bot:
- Navigate to Settings > Forum AI Bot
- Configure AI provider and API key
- Set bot user account and behavior settings
// Example: Configure bot via WordPress options
update_option('ai_bot_selected_provider', 'openai');
update_option('ai_bot_selected_model', 'gpt-4');
update_option('ai_bot_user_id', 2); // WordPress user ID for bot account
update_option('ai_bot_trigger_keywords', 'help,question,support');
The plugin uses the AI HTTP Client library for multi-provider support:
// API keys are managed via ai_provider_api_keys filter
add_filter('ai_provider_api_keys', function($keys) {
$keys['openai'] = 'sk-your-openai-key-here';
$keys['anthropic'] = 'your-anthropic-key-here';
return $keys;
});
// Restrict bot to specific forums
update_option('ai_bot_forum_restriction', 'selected');
update_option('ai_bot_allowed_forums', [12, 15, 18]); // Forum IDs
// Configure context retrieval limits
update_option('ai_bot_local_search_limit', 5); // Local content results
update_option('ai_bot_remote_search_limit', 3); // Remote content results
update_option('ai_bot_remote_endpoint_url', 'https://example.com/wp-json/');
@Mentions: Bot responds when mentioned in topics or replies
@botuser Can you help me with WordPress hooks?
Keywords: Bot responds to configured trigger keywords
I have a question about bbPress integration
Manual Triggers: Force bot response with specific phrases
Hey bot, what do you think about this?
Configure bot personality and behavior:
// System prompt for bot behavior
update_option('ai_bot_system_prompt',
'You are a helpful WordPress expert specializing in bbPress forums.
Provide clear, actionable advice with code examples when appropriate.'
);
// Additional custom instructions
update_option('ai_bot_custom_prompt',
'Always include relevant documentation links and suggest best practices.'
);
// Control AI creativity (0.0-1.0)
update_option('ai_bot_temperature', 0.7); // Balanced creativity
The plugin follows a clean service container pattern with AI tool-based search:
// Main services
AiBot\Core\AiBot // WordPress hooks orchestrator
AiBot\Core\Bot_Trigger_Service // Mention/keyword detection
AiBot\Core\Generate_Bot_Response // AI response orchestration with tool calling
AiBot\Core\System_Prompt_Builder // Centralized prompt construction
// AI search tools
AiBot\Tools\Local_Search_Tool // AI tool for local content search
AiBot\Tools\Remote_Search_Tool // AI tool for remote content search
// Context system
AiBot\Context\Content_Interaction_Service // Conversation message formatting
AiBot\Context\Database_Agent // Database search engine
// Register custom AI search tool
add_filter('ai_tools', function($tools) {
$tools['custom_search'] = [
'name' => 'custom_search',
'description' => 'Search custom data source for relevant information',
'class' => 'Custom\Search_Tool',
'method' => 'execute',
'category' => 'search',
'parameters' => [
'query' => [
'type' => 'string',
'description' => 'Search query for custom data',
'required' => true
]
]
];
return $tools;
});
// Add custom trigger logic
add_filter('ai_bot_should_respond', function($should_respond, $content, $topic_id) {
// Custom logic for when bot should respond
if (strpos($content, 'emergency') !== false) {
return true;
}
return $should_respond;
}, 10, 3);
// Modify available tools per request
add_filter('ai_tools', function($tools, $context) {
// Remove remote search for sensitive topics
if (isset($context['sensitive']) && $context['sensitive']) {
unset($tools['remote_search']);
}
return $tools;
}, 10, 2);
// Modify bot responses before posting
add_filter('ai_bot_response_content', function($response, $context) {
// Add signature or modify response
return $response . "\n\n*This response was generated by AI*";
}, 10, 2);
// Fires when bot posts a reply
do_action('ai_bot_posted_reply', $reply_id, $topic_id, $response_content);
// Fires on AI API errors
do_action('ai_api_error', $error_data);
// Modify API request before sending
apply_filters('ai_bot_api_request', $request_data, $provider);
// Modify system prompt
apply_filters('ai_bot_system_prompt', $prompt, $context);
// Control bot response decision
apply_filters('ai_bot_should_respond', $should_respond, $content, $topic_id);
// Modify final response
apply_filters('ai_bot_response_content', $response, $context);
Bot not responding:
// Check bot configuration
$provider = get_option('ai_bot_selected_provider');
$model = get_option('ai_bot_selected_model');
$user_id = get_option('ai_bot_user_id');
// Verify API keys
$api_keys = apply_filters('ai_provider_api_keys', []);
API errors:
// Enable error logging
add_action('ai_api_error', function($error_data) {
error_log('AI Bot Error: ' . $error_data['message']);
});
Forum restrictions:
// Check forum access
$restriction = get_option('ai_bot_forum_restriction');
$allowed_forums = get_option('ai_bot_allowed_forums', []);
// Enable detailed logging
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
// View logs
tail -f /wp-content/debug.log
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature
- Follow WordPress coding standards
- Test with multiple AI providers
- Submit pull request
- WordPress: 5.0+
- PHP: 7.4+
- bbPress: Latest version
- API Keys: At least one supported AI provider
GPLv2 or later - https://www.gnu.org/licenses/gpl-2.0.html
- Documentation: See CLAUDE.md for technical details
- Issues: Report bugs via plugin repository
- WordPress.org: https://wordpress.org/plugins/ai-bot-for-bbpress/