1. Which URL Pattern Should Be Used?
Use the WordPress rest_route query format with &token=:
text
https://yoursite.com/index.php?rest_route=/nextgen-importer/v1/cron/process&token=YOUR_TOKENWhy index.php?rest_route=... instead of /wp-json/... or index.php/wp-json/...?
- Universal compatibility: Works across all WordPress permalink structures (including Plain permalinks), Apache servers without
mod_rewrite/.htaccess, Nginx servers withoutPATH_INFO, and local environments (MAMP, LocalWP, XAMPP, Docker). - Important separator rule: Because
?rest_route=already starts the query string with?, the token parameter must use&token=(never a second?token=).
2. curl vs /usr/bin/curl — How to Know Which One to Use
| Environment | What to Use | Why |
|---|---|---|
SSH / crontab -e (Linux / macOS) |
/usr/bin/curl |
System cron runs with a minimal PATH (typically /usr/bin:/bin). Using the full path prevents curl: command not found. |
| cPanel / DirectAdmin / Hostinger Cron UI | curl or /usr/bin/curl |
Hosting panels usually configure a standard shell PATH, and you only paste the command (the schedule * * * * * is selected via dropdowns). |
| EasyCron / UptimeRobot / Plesk "Fetch a URL" | URL only | External HTTP cron services only need the URL (https://...&token=...) with no curl command at all. |
How to Check Your Exact curl Path in 1 Second
Run this in Terminal or SSH:
bash
which curl- If it outputs
/usr/bin/curl(standard on macOS, Ubuntu, Debian, CentOS, AlmaLinux) → use/usr/bin/curl. - If it outputs a different path (for example
/usr/local/bin/curlor/opt/homebrew/bin/curl) → use that exact path incrontab -e.
3. Ready-to-Use Examples
A. SSH / crontab -e (Full Line, Every Minute)
cron
* * * * * /usr/bin/curl -s "https://yoursite.com/index.php?rest_route=/nextgen-importer/v1/cron/process&token=YOUR_TOKEN" > /dev/null 2>&1- Always keep double quotes
"..."around the URL so the shell does not interpret&beforetoken=as a background-job operator. -ssilencescurlprogress meters;> /dev/null 2>&1prevents cron from sending email output every minute.
B. cPanel / Hosting Panel UI (Command Only)
Select Once Per Minute (* * * * *) in the panel dropdowns, then paste:
bash
curl -s "https://yoursite.com/index.php?rest_route=/nextgen-importer/v1/cron/process&token=YOUR_TOKEN" > /dev/null 2>&1C. Testing Manually in Terminal
Run without > /dev/null 2>&1 to inspect the JSON response:
bash
/usr/bin/curl -i -sS "https://yoursite.com/index.php?rest_route=/nextgen-importer/v1/cron/process&token=YOUR_TOKEN"Expected success response (HTTP/1.1 200 OK):
json
{"success":true,"processed_imports":0,"execution_time":1,"message":"External cron processing cycle completed."}4. Quick Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
403 Forbidden (rest_forbidden) |
Token in cron does not match the saved Global Settings → External Cron Secret Key, or Global Settings wasn't saved after regenerating the key. | Copy the exact current token from Global Settings → External Cron, click Save Settings, and update your cron command. |
curl: command not found in cron logs |
cron PATH does not include curl's directory. |
Run which curl over SSH and use the full path (e.g., /usr/bin/curl). |
token missing / ignored |
URL has two ? characters (?rest_route=...?token=) or missing quotes "..." around the URL. |
Use &token= and wrap the entire URL in "...". |