WordPress Quickstart

License-protect your WordPress plugin or theme in minutes.

5 minute setup
$ composer require traffic-orchestrator/wordpress
1

Install the Plugin

Add the Traffic Orchestrator WordPress plugin to your theme or plugin project.

bash
# Via Composer (recommended for developers)
composer require traffic-orchestrator/wordpress

# Or download and install via WordPress Admin
# Plugins → Add New → Upload → traffic-orchestrator.zip
2

Configure in Settings

Navigate to Settings → Traffic Orchestrator and enter your API URL and key.

php
// Or configure programmatically in functions.php
add_filter('traffic_orchestrator_config', function($config) {
    $config['api_url']  = 'https://api.trafficorchestrator.com/api/v1';
    $config['api_key']  = defined('TO_API_KEY') ? TO_API_KEY : '';
    $config['product']  = 'my-wp-plugin';
    return $config;
});
3

Validate with Shortcode

Use the built-in shortcode to gate content based on license status.

html
<!-- Gate premium content with a shortcode -->
[to_license_check key="TO-XXXX-XXXX-XXXX"]
  <p>This content is only visible to licensed users.</p>
  <p>Premium features enabled!</p>
[/to_license_check]

<!-- Show upgrade prompt for invalid licenses -->
[to_license_check key="TO-XXXX-XXXX-XXXX" fallback="upgrade"]
  <p>Pro-only analytics dashboard</p>
[/to_license_check]
4

Validate Programmatically

Check license status in your plugin or theme code.

php
// In your plugin code
$to = TrafficOrchestrator::getInstance();
$result = $to->validate('TO-XXXX-XXXX-XXXX');

if ($result['valid']) {
    // License is active
    $features = $result['features'];
    
    if (in_array('pro', $features)) {
        // Enable pro features
        add_filter('my_plugin_pro_enabled', '__return_true');
    }
} else {
    // Show license activation notice in admin
    add_action('admin_notices', 'show_license_notice');
}
5

Admin License Page

The plugin automatically adds a license management page to wp-admin.

php
// The plugin provides:
// 1. Settings → Traffic Orchestrator (config page)
// 2. License activation/deactivation UI
// 3. REST endpoint: /wp-json/traffic-orchestrator/v1/validate

// Customize the admin notice
add_filter('to_license_notice', function($html) {
    return '<div class="notice notice-warning">
        <p>Enter your license key to unlock premium features.
        <a href="' . admin_url('options-general.php?page=traffic-orchestrator') . '">
        Activate Now</a></p>
    </div>';
});
6

Auto-Update with License

Gate plugin updates behind a valid license — only licensed users get updates.

php
// In your plugin's main file
add_filter('pre_set_site_transient_update_plugins', function($transient) {
    $to = TrafficOrchestrator::getInstance();
    $license = $to->validate(get_option('my_plugin_license_key'));

    if (!$license['valid']) {
        // No valid license — no updates
        return $transient;
    }

    // Check for new version from your update server
    $update_info = $to->checkForUpdate('my-wp-plugin');
    if ($update_info && version_compare($update_info['version'], MY_PLUGIN_VERSION, '>')) {
        $transient->response['my-plugin/my-plugin.php'] = (object) $update_info;
    }
    return $transient;
});