Developers / WordPress Integration
WordPress Integration
Overview
The Topmast WordPress plugin handles all API communication automatically. This guide covers how the integration works and how to customize it.
Installation
The plugin isn't in the WordPress.org plugin directory yet: it is installed from a ZIP file you download from the
dashboard (Sites → Download plugin, with a plan or a trial).
Via WordPress Admin
- Go to Plugins > Add New > Upload Plugin
- Upload the ZIP file and activate
Via WP-CLI
wp plugin install ./topmast-X.Y.Z.zip --activateOnce connected, the plugin keeps itself up to date from Topmast.
Initial Setup
1. Connect Your Site
- Navigate to Topmast → Settings in WordPress admin
- Click Connect to Topmast
- Log in to your Topmast account
- Confirm the site on the page that opens; WordPress comes back connected
Behind the button, WordPress asks Topmast for a single-use code (server to server), the browser carries only that code
to the dashboard, and after you confirm, WordPress claims the site's API key server to server. Before handing the key
over, Topmast checks the site itself answers for that code at /?topmast_connect_proof=…, so a connect started from
anywhere else can't take the key. Re-connecting a site that is already in your account gives it a new key. You can
still paste a key by hand under Or paste an API key.
2. Run Initial Scan
wp topmast scan --forceOr click Scan Site in the admin dashboard.
3. Generate LLMs.txt
wp topmast llms-txt generateHow It Works
Content Sync Flow
WordPress → Scan Content → Transform → POST /api/sites/sync → Database- Plugin scans pages, posts, and custom post types
- Content is transformed to sync payload format
- Inventory is sent to Topmast API
- Readiness score is calculated and stored
LLMs.txt Generation
GET /api/sites/{id}/llms-txt → Generate → Cache → Return- Plugin requests LLMs.txt from API
- API generates content using AI
- Content is cached locally
- File is served at
/llms.txt
Plugin Settings
General Settings
| Setting | Description | Default |
|---|---|---|
| Auto-sync | Sync on content publish | Enabled |
| Sync interval | How often to full sync | Daily |
| Include drafts | Include draft posts | Disabled |
Content Settings
| Setting | Description | Default |
|---|---|---|
| Post types | Which types to include | page, post |
| Exclude categories | Categories to skip | None |
| Max pages | Maximum pages to sync | 500 |
LLMs.txt Settings
| Setting | Description | Default |
|---|---|---|
| Auto-regenerate | Regenerate on sync | Disabled |
| Cache duration | How long to cache | 24 hours |
Hooks and Filters
Modify Sync Payload
add_filter('topmast_sync_payload', function($payload, $site_id) {
// Add custom data to sync
$payload['custom_field'] = 'value';
return $payload;
}, 10, 2);Exclude Posts from Scan
add_filter('topmast_scan_exclude_post', function($exclude, $post) {
// Exclude posts with specific meta
if (get_post_meta($post->ID, 'hide_from_ai', true)) {
return true;
}
return $exclude;
}, 10, 2);Customize LLMs.txt Content
add_filter('topmast_llms_txt_content', function($content, $site_data) {
// Add custom section
$content .= "\n\n## Custom Section\nAdditional content...";
return $content;
}, 10, 2);Before/After Sync Actions
add_action('topmast_before_sync', function($site_id) {
// Run before sync starts
error_log('Starting sync for site: ' . $site_id);
});
add_action('topmast_after_sync', function($site_id, $result) {
// Run after sync completes
if ($result['success']) {
error_log('Sync completed: ' . $result['pages_synced'] . ' pages');
}
}, 10, 2);WP-CLI Commands
Full CLI documentation:
wp topmast --helpCommon Commands
# Check connection status
wp topmast status
# Validate API key
wp topmast validate
# Run content scan
wp topmast scan --force
# Sync inventory
wp topmast sync
# Generate LLMs.txt
wp topmast llms-txt generate
# View summaries
wp topmast summaries listTroubleshooting
Connection Issues
# Test API connectivity
wp topmast validate --debugSync Failures
- Check error logs: Topmast > Logs
- Verify API key is valid
- Check server can reach
topmast.appandaioradar.vercel.app(the addresses the plugin calls)
LLMs.txt Not Updating
# Force regeneration
wp topmast llms-txt generate --force
# Clear cache
wp topmast llms-txt clearRewrite Rules Not Working
# Flush permalinks
wp rewrite flushOr visit Settings > Permalinks and click Save.