Documentation · Troubleshooting
Cron Errors
This document covers problems related to scheduled import automation, including WP-Cron failures, server-cron configuration issues and image queue worker errors.
When to use this document
Read this document when:
- Automatic imports are not running at the configured schedule.
- The last import run time displayed on the admin dashboard is not advancing.
- The plugin log shows no import activity even though automation is enabled.
- The REST-based cron endpoint is returning errors or not triggering imports.
- The image queue worker is not processing queued images.
Overview
The plugin supports two import automation modes:
- WP-Cron mode (default): imports are triggered by WordPress's built-in pseudo-cron system (
wp-cron.php). WP-Cron runs when a WordPress page is loaded; on low-traffic sites it may not fire reliably. - Server-cron mode: a real operating-system cron job calls either
wp-cron.phpor the plugin's dedicated REST endpoint at a fixed interval. This is more reliable and is recommended for production sites.
Both modes use the same shared import runner (Scheduler::run_import()). The result is identical regardless of which trigger is used.
Available schedule options
When WP-Cron automation is enabled, the following schedules are available:
| Schedule key | Interval |
|---|---|
hourly | Every 60 minutes |
as24ci_every_6_hours | Every 6 hours |
twicedaily | Twice per day |
daily | Once per day |
as24ci_custom | Custom interval (minimum 15 minutes, configurable) |
For daily and twicedaily schedules, a start time (HH:MM, 24-hour format, in the WordPress site timezone) can be configured. The default start time is 06:00.
REST cron endpoint
The plugin registers a REST endpoint that can be called by an external scheduler:
GET /wp-json/as24ci/v1/cron-import
Authentication is required. The preferred method is:
Authorization: Bearer YOUR_TOKEN
The token can also be passed as a query parameter (?token=YOUR_TOKEN), though using the header is recommended to avoid the token appearing in server access logs.
The token is generated automatically and is visible in the plugin's Import & Limits settings tab. You can regenerate it from the same screen.
Image queue worker
During cron and REST import runs, when image queue mode is enabled, the plugin queues remaining vehicle images for asynchronous processing. A separate WP-Cron hook (as24ci_image_queue_process) runs the image queue worker. This worker processes up to 30 images per batch and continues until the queue is empty or the time budget is exhausted. If items remain, it reschedules itself automatically.
Prerequisites
- Auto-import is enabled in the plugin settings (Import & Limits → Automation tab).
- At least one seller ID is configured.
- The API connection is working. Verify on the System Status page.
- For server-cron mode: the hosting environment supports scheduled jobs (cron, scheduled tasks, or an equivalent service).
Diagnostic steps
Step 1: Confirm automation is enabled
- Go to the plugin Import & Limits → Automation tab.
- Confirm Enable automatic import is toggled on.
- Confirm the desired schedule is selected.
- Save settings if any changes were made.
Step 2: Check the last run time
- On the plugin admin dashboard or System & Help tab, check the Last import run timestamp.
- If the timestamp is older than two full schedule intervals, automation is likely not firing.
Step 3: Verify the WP-Cron event is scheduled
For WP-Cron mode:
- Use a WordPress plugin that can list scheduled events (for example, WP Crontrol) or WP-CLI:
``
wp cron event list`` - Look for the hook
as24ci_scheduled_import. Confirm it is present and its next-run time is in the future. - If the hook is absent, re-save the automation settings in the plugin to reschedule it.
Step 4: Verify WP-Cron is working on this site
WP-Cron may be disabled on some hosting environments or by performance plugins:
- Check
wp-config.phpfor the line: ``php define('DISABLE_WP_CRON', true);`If this constant is set totrue`, WP-Cron is disabled. You must use a server-cron or the REST endpoint instead. - Confirm that page requests are being made to the site regularly (at least once per schedule interval). On low-traffic sites, WP-Cron may not fire at the expected time.
- Use a service that regularly pings your site URL to ensure WP-Cron has opportunities to run, or switch to server-cron mode.
Step 5: Test the REST cron endpoint
If you are using or plan to use the REST endpoint:
- Retrieve the cron token from Import & Limits → Cron Token section.
- Send a test request from your server:
``
curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://your-site.example.com/wp-json/as24ci/v1/cron-import"`` - A successful response returns HTTP 200 with
"success": trueand import counts. - A 403 response indicates an invalid or missing token. Verify the token in the plugin settings.
- A 429 response indicates the import is already in progress (lock is active). Wait and retry.
- A 500 response indicates an exception during the import run. Check the plugin log for details.
If the REST API is not reachable, confirm that pretty permalinks are enabled (Settings → Permalinks → Save) and that the WordPress REST API is not blocked by a security plugin or server configuration.
Step 6: Verify external cron ping recording
If you are using a server-cron job that calls wp-cron.php directly, you can append ?as24ci_cron=1 to the URL to record the ping:
https://your-site.example.com/wp-cron.php?doing_wp_cron&as24ci_cron=1
The plugin records the timestamp of this ping and displays it on the System & Help tab as the last external cron activity time.
Step 7: Check for a stale import lock
If a previous import run was interrupted without releasing its lock, subsequent runs will be skipped for up to 40 minutes. The log will contain:
Import runner (wp-cron): already in progress, skipping.
If the lock is genuinely stale (the original run is no longer active), wait for the 40-minute TTL to expire. The lock is automatically cleared if it is older than 40 minutes when the next run attempts to start.
To clear the lock immediately:
- Delete the WordPress transient
as24ci_cron_import_runningusing a transient management plugin or WP-CLI: ``wp transient delete as24ci_cron_import_running``
Step 8: Investigate image queue worker failures
If images are not being processed after import:
- Check the plugin log for entries containing
Image queue worker. - Confirm the hook
as24ci_image_queue_processis present in the WP-Cron event list. - If the image queue lock (
as24ci_image_queue_running) is stale, delete it: ``wp transient delete as24ci_image_queue_running`` The image queue lock has a 10-minute TTL and is also auto-cleared when stale. - Check the Image queue last run stats on the System & Help tab for the count of processed, failed and remaining items.
Configuration reference
| Setting | Location | Description |
|---|---|---|
| Enable automatic import | Import & Limits → Automation | Master switch for WP-Cron automation. Default: disabled. |
| Schedule | Import & Limits → Automation | Import frequency. Default: hourly. |
| Start time | Import & Limits → Automation | For daily / twice-daily schedules. Default: 06:00 (site timezone). |
| Custom interval (minutes) | Import & Limits → Automation | For custom schedule. Minimum: 15 minutes. Default: 30 minutes. |
| Cron mode | Import & Limits | Controls which trigger type is used (wp-cron or server-cron). |
| Cron token | Import & Limits | Secret token for the REST endpoint. Auto-generated. Can be regenerated. |
| Max vehicles per run | Import & Limits | Limits vehicles processed per automated run. 0 = unlimited. |
| Image queue mode | Import & Limits | Queue additional vehicle images for background processing. Default: enabled. |
Operational notes
- WP-Cron events require page load traffic to fire. On staging or development sites with no regular visitors, WP-Cron will not run reliably. Use the REST endpoint with a real server-cron job instead.
- The import runner attempts to set a 300-second PHP execution time limit before running. On hosting that restricts
set_time_limit, this may not succeed. The log will record a warning if this happens. Very large catalogues may time out on restrictive hosting. - The lock TTL for the main import is 40 minutes (2400 seconds). The lock for the image queue worker is 10 minutes (600 seconds).
- The cron token is stored in plain text in WordPress options. Treat it as a secret. Do not share it in public forums or commit it to version control.
- The image queue can hold up to 20,000 items before a warning is logged and a deduplication pass runs.
- Running the import via the Trigger now admin button uses the same shared runner as WP-Cron and the REST endpoint. It is subject to the same lock and will be blocked if an import is already in progress.
Troubleshooting
| Symptom | Likely cause | Check |
|---|---|---|
| Imports not running automatically | Auto-import disabled | Enable automation in Import & Limits settings |
as24ci_scheduled_import not in cron list | Event was unscheduled after settings change | Re-save automation settings to reschedule |
DISABLE_WP_CRON is set | WP-Cron is globally disabled | Use server-cron or REST endpoint instead |
| Import fires but "already in progress" in log | Stale import lock | Wait 40 minutes or delete as24ci_cron_import_running transient |
| REST endpoint returns HTTP 403 | Token is wrong, missing or not configured | Verify token in Import & Limits settings |
| REST endpoint returns HTTP 429 | Import lock is active | Wait and retry; if persistent, delete the lock transient |
| REST endpoint returns HTTP 500 | Exception during import | Check log for details |
| REST API not reachable | Permalinks not set, or REST API blocked | Flush permalinks; check security plugin settings |
| Image queue not processing | WP-Cron cannot fire or image queue lock is stale | Verify WP-Cron; delete as24ci_image_queue_running transient if stale |
| Last external cron time not updating | Server cron is not calling the endpoint or ?as24ci_cron=1 is not appended | Verify the cron job command and URL |
| Import times out on large catalogue | PHP execution time too short | Use server-cron; contact hosting to increase PHP max execution time |