This is a standalone demo plugin that showcases WP-Queue capabilities with real-world examples for blogs and e-commerce. It provides both code examples for developers and an interactive UI for users.
- WP-Queue plugin must be installed and activated
- WordPress 6.0+
- PHP 8.3+
- Install and activate the WP-Queue plugin first
- Download and install this demo plugin
- Activate WP-Queue Demo Examples
- Access the interactive dashboard at WP Admin → WP-Queue Demo
Blog/IM task: Write array of messages to log file for audit actions.
- Features: Processing array data in a single job.
- Call:
?example_job=log_batch— creates and writes 3 test messages towp-content/batch-log.txt.
E-commerce task: Send marketing emails to customers.
- Features:
- Run every 10 minutes via
#[Schedule('10min')]. - Retry up to 5 times on error via
#[Retries(5)]. - Timeout 60 sec via
#[Timeout(60)].
- Run every 10 minutes via
- Call:
?example_job=email_batch— test dispatch (replace emails with real ones).
Blog task: Automatic publication of posts from drafts + notification of subscribers.
- Features:
- Daily run via
#[Schedule('daily')]. - Retry 3 times on email sending error.
- Creates posts, sends notifications, writes report to
batch-report.log.
- Daily run via
- Call:
?example_job=publish_batch— creates 2 posts and sends emails.
Blog task: New user registration with greeting and subscription.
- Features:
- Chain: create user → send email → add to newsletter.
- Unique jobs via
#[UniqueJob]prevent duplication.
- Call:
?example_job=user_register— creates test user.
E-commerce task: Automatic inventory monitoring and reordering.
- Features:
- Custom interval every 2 hours via
#[Schedule('2hourly')]. - Queue pause if supplier is offline (night time).
- Automatic reordering when stock is low.
- Custom interval every 2 hours via
- Call:
?example_job=inventory_check— manual check (usually by cron).
E-commerce task: Synchronization of order statuses with delivery service.
- Features:
- Run every 15 minutes with retry on API errors.
- Handling network errors and service unavailability.
- Updating order statuses in WooCommerce.
- Call:
?example_job=order_sync— manual synchronization.
E-commerce task: Importing product catalog from CSV file.
- Features:
- Process file in chunks (pagination) to avoid overloading DB.
- Recursive dispatch of next pages with delay.
- Creating WooCommerce products.
- Call:
?example_job=product_import— needs filewp-content/products.csv.
E-commerce task: Sales analysis and sending alerts on problems.
- Features:
- Hourly analysis of last hour sales.
- Logging via events (
wp_queue_job_processed,wp_queue_job_failed). - Sending alerts to admin on low sales.
- Call:
?example_job=sales_report— generate sales report.
The plugin includes a comprehensive visual dashboard accessible via WP Admin → WP-Queue Demo that provides:
- Interactive job cards for each example with visual status indicators
- One-click job execution with real-time status updates
- Progress monitoring with animated status changes (Ready → Queued → Running → Completed/Failed)
- Activity logs with auto-refresh showing job processing activity
- Color-coded complexity levels (Simple/Medium/Complex)
- Responsive design that works on all devices
- Status Indicators: Visual badges showing job states with animations
- AJAX Updates: Real-time status polling without page refreshes
- Error Handling: Clear error messages and status updates
- Log Monitoring: Live activity feed with scrollable log container
- Batch Operations: Run multiple examples and track their progress simultaneously
The dashboard makes it easy to demonstrate and test all WP-Queue capabilities interactively!
example-plugin.php– main plugin file with dependency checks and initialization.admin-page.php– visual demo dashboard with interactive controls.assets/css/demo.css– styling for the demo dashboard.assets/js/demo.js– JavaScript for interactive job execution and monitoring.Jobs/BatchLogJob.php– Example 1: array data processing.Jobs/BatchEmailJob.php– Example 2: sending emails with cron and retry.Jobs/BatchPublishAndNotifyJob.php– Example 3: publishing posts + emails + report.Jobs/UserRegistrationJobs.php– Example 4: registration chain with unique jobs.Jobs/InventoryJobs.php– Example 5: inventory monitoring with custom intervals.Jobs/OrderSyncJob.php– Example 6: synchronization with external APIs.Jobs/ProductImportJob.php– Example 7: import with pagination.Jobs/SalesMonitoringJob.php– Example 8: monitoring with events.manual-dispatch.php– 8 manual dispatch examples.
Each job class demonstrates different WP-Queue features:
- Attributes:
#[Schedule],#[Queue],#[Retries],#[Timeout],#[UniqueJob] - Base Job Class: Extends
WPQueue\Jobs\Jobwith minimal boilerplate - Error Handling: Retry logic and exception handling
- Event System: Integration with WP-Queue events
- Real-world Patterns: Common e-commerce and blog automation tasks
All comments in the code contain step-by-step explanations so you understand what and why it's done.
