Advanced Options
Power-user configuration for custom deployments, performance tuning, and developer integration.
This guide covers advanced configuration options for power users, developers, and custom deployments.
wp-config.php Constants
Define these constants in your wp-config.php for low-level configuration:
Core Settings
// Enable debug mode
define('SPS_DEBUG', true);
// Set log level (error, warning, info, debug)
define('SPS_LOG_LEVEL', 'debug');
// Custom log directory
define('SPS_LOG_DIR', '/path/to/logs/');
Performance Tuning
// Increase memory limit for generation
define('SPS_MEMORY_LIMIT', '512M');
// Extend execution time
define('SPS_MAX_EXECUTION_TIME', 600);
// Batch processing size
define('SPS_BATCH_SIZE', 20);
// Disable image processing (text-only mode)
define('SPS_DISABLE_IMAGES', false);
Network Configuration
// API request timeout (seconds)
define('SPS_API_TIMEOUT', 60);
// Proxy server (if required)
define('SPS_PROXY_HOST', 'proxy.example.com');
define('SPS_PROXY_PORT', 8080);
define('SPS_PROXY_USER', 'username');
define('SPS_PROXY_PASS', 'password');
// Disable SSL verification (not recommended)
define('SPS_SSL_VERIFY', true);
Update Settings
// Enable custom update server (premium versions)
define('SPS_ENABLE_CUSTOM_UPDATER', true);
define('SPS_UPDATE_SERVER_URL', 'https://updates.yourdomain.com');
// Disable automatic updates
define('SPS_AUTO_UPDATE', false);
Database Configuration
Custom Tables
SuperSense creates these custom tables:
| Table | Purpose |
|---|---|
{prefix}_sps_projects | Project data |
{prefix}_sps_keywords | Keyword storage |
{prefix}_sps_logs | Activity logs |
{prefix}_sps_queue | Auto-post queue |
Table Maintenance
-- View table sizes
SELECT
table_name,
ROUND(data_length/1024/1024, 2) as data_mb,
ROUND(index_length/1024/1024, 2) as index_mb
FROM information_schema.tables
WHERE table_name LIKE '%sps_%';
-- Clean old logs
DELETE FROM wp_sps_logs WHERE created_at < DATE_SUB(NOW(), INTERVAL 30 DAY);
-- Optimize tables
OPTIMIZE TABLE wp_sps_keywords;
Database Indexes
For high-volume sites, add additional indexes:
-- Speed up keyword lookups
CREATE INDEX idx_keyword_status ON wp_sps_keywords(status, project_id);
-- Speed up log queries
CREATE INDEX idx_log_date ON wp_sps_logs(created_at);
Hooks & Filters
Action Hooks
// Before content generation
add_action('sps_before_generate', function($keyword, $project) {
// Custom logic before generation
}, 10, 2);
// After successful generation
add_action('sps_after_generate', function($post_id, $keyword) {
// Custom post-processing
}, 10, 2);
// Before auto-post runs
add_action('sps_before_autopost', function() {
// Pre-autopost logic
});
// After image attachment
add_action('sps_after_image_attach', function($attachment_id, $post_id) {
// Custom image processing
}, 10, 2);
Filter Hooks
// Modify generated content before saving
add_filter('sps_generated_content', function($content, $keyword) {
// Modify content
return $content;
}, 10, 2);
// Modify post title
add_filter('sps_post_title', function($title, $keyword) {
return $title;
}, 10, 2);
// Filter images before attachment
add_filter('sps_images', function($images, $keyword) {
// Filter or modify images array
return $images;
}, 10, 2);
// Modify post data before insert
add_filter('sps_post_data', function($post_data) {
// Modify WordPress post array
return $post_data;
});
// Custom keyword filtering
add_filter('sps_filter_keyword', function($allow, $keyword) {
// Return false to block keyword
return $allow;
}, 10, 2);
WP-CLI Commands
Full list of available CLI commands:
Project Management
# List all projects
wp sps project list
# Create a project
wp sps project create --name="My Project" --language=en
# Update project
wp sps project update 1 --status=active
# Delete project
wp sps project delete 1 --force
Keyword Management
# Add keywords
wp sps keyword add 1 "keyword one" "keyword two"
# Import from file
wp sps keyword import 1 keywords.txt
# Export keywords
wp sps keyword export 1 --status=pending > pending.txt
# Reset keyword status
wp sps keyword reset 1 --status=failed
Content Generation
# Generate single post
wp sps generate --keyword-id=123
# Generate for project
wp sps generate --project-id=1 --limit=5
# Batch generate
wp sps generate --batch --limit=10
# Dry run (no actual generation)
wp sps generate --dry-run
Auto-Post Control
# Check status
wp sps autopost status
# Start/stop
wp sps autopost start
wp sps autopost stop
# Run once
wp sps autopost run
# View queue
wp sps autopost queue
# Clear queue
wp sps autopost clear
Maintenance
# Clean old logs
wp sps cleanup logs --days=30
# Clean orphaned images
wp sps cleanup images
# Reset all data (dangerous)
wp sps reset --confirm
REST API
Authentication
SuperSense REST endpoints require authentication:
# Using Application Passwords
curl -X GET \
-u "username:application_password" \
https://yoursite.com/wp-json/sps/v1/projects
Available Endpoints
| Endpoint | Method | Description |
|---|---|---|
/sps/v1/projects | GET | List projects |
/sps/v1/projects/{id} | GET | Get project |
/sps/v1/projects | POST | Create project |
/sps/v1/keywords | GET | List keywords |
/sps/v1/keywords | POST | Add keywords |
/sps/v1/generate | POST | Trigger generation |
/sps/v1/status | GET | System status |
Example Requests
# Get all projects
curl -X GET \
-u "user:pass" \
https://yoursite.com/wp-json/sps/v1/projects
# Add keywords
curl -X POST \
-u "user:pass" \
-H "Content-Type: application/json" \
-d '{"project_id": 1, "keywords": ["keyword1", "keyword2"]}' \
https://yoursite.com/wp-json/sps/v1/keywords
# Trigger generation
curl -X POST \
-u "user:pass" \
-H "Content-Type: application/json" \
-d '{"keyword_id": 123}' \
https://yoursite.com/wp-json/sps/v1/generate
Cron Configuration
Reliable Cron Setup
For production sites, use system cron:
# /etc/cron.d/wordpress-sps
# Run WordPress cron every minute
* * * * * www-data cd /var/www/html && wp cron event run --due-now > /dev/null 2>&1
# Run SuperSense specific tasks every 5 minutes
*/5 * * * * www-data cd /var/www/html && wp sps cron run > /dev/null 2>&1
Disable WP-Cron
In wp-config.php:
define('DISABLE_WP_CRON', true);
Verify Cron
# Check scheduled events
wp cron event list | grep sps
# Check if events are running
wp sps cron status
Multisite Configuration
Network Activation
SuperSense can be network-activated:
- Network activate the plugin
- Each site maintains its own data
- Licenses may require per-site activation
Per-Site Settings
Override network defaults per site:
// In wp-config.php or site-specific config
define('SPS_SITE_SETTINGS', [
'site_id' => [
'api_limit' => 1000,
'interval' => 120,
]
]);
Performance Optimization
For High-Volume Sites
// Increase batch processing
define('SPS_BATCH_SIZE', 50);
// Enable async processing
define('SPS_ASYNC_GENERATION', true);
// Reduce logging
define('SPS_LOG_LEVEL', 'error');
// Cache templates
define('SPS_CACHE_TEMPLATES', true);
Database Optimization
-- Add partitioning for large log tables
ALTER TABLE wp_sps_logs
PARTITION BY RANGE (TO_DAYS(created_at)) (
PARTITION p_old VALUES LESS THAN (TO_DAYS('2024-01-01')),
PARTITION p_2024_q1 VALUES LESS THAN (TO_DAYS('2024-04-01')),
PARTITION p_2024_q2 VALUES LESS THAN (TO_DAYS('2024-07-01')),
PARTITION p_future VALUES LESS THAN MAXVALUE
);
Memory Management
// Process in smaller chunks
add_filter('sps_batch_size', function() {
return 5; // Smaller batches
});
// Force garbage collection
add_action('sps_after_generate', function() {
gc_collect_cycles();
});
Warning: Advanced configuration changes can affect plugin stability. Test thoroughly in a staging environment first.