[Resolved] WP All Export Pro Cron job to hit Cron URL not working unless I deactivate Types
This thread is resolved. Here is a description of the problem and solution.
Problem:
You have a CPT created by Types, and deny read permissions to guests using Access to that CPT, then Export CRON Jobs run with the WP All Import plugin, do run, but do not export anything.
As soon as Access grants read permissions for guests on that CPT, OR Access is disabled, OR Access is restricting read access but you run the CRON manually in the Browser (logged in), the CRON properly runs and exports entries successfully.
Solution:
Set "read" to true for CPT guests permissions (CRON is a guest 🙂 )
There is one more solution, create a role copy of administrator, create a user and write a small plugin to open a session when WP runs from CRON. 'DOING_CRON' constant will help.
This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Please see hidden link - it's basically a Cron job that hits the Cron URLs.
If I run the URL 'manually' in a browser window all works fine.
If I create a Cron job from the cPanel the processing script does not export any records.
curl 'hidden link' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'
curl 'hidden link' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'
Also tried wget with same result.
If I deactivate just the Toolset Types plugin the above Cron jobs work as expected.
Is there anything that you can do to help both plugins to work together?
My colleague set up a test server and installed WP All Export Pro and added cron jobs as per the instructions and it worked okay without any errors.
She would like to take a look at your set-up to see if she can spot what the problem is.
Let me mark your next reply as private.
We will need not only the normal WP credentials, but also your hosting credentials, whatever is required to access your server and the cPanel, if that's okay.
Yes tried the simpler curl version first which also didn't work (the extra was added in case something was blocking calls that don't have user-agent headers). Also tried wget. Running manually is fine.
I will add again to cPanel (I removed it as triggering emails, so will add >/dev/null 2>&1 to the suggested simplified curl).
The trigger works fine, it's the processing that does not.
This is expected behaviour - and the same error would happen if I run the processing URL manually if I do NOT run the trigger URL first.
So basically you HAVE to run the trigger URL first (this does seem to work in the cron job). Then the processing URL will return {"status":200,"message":"Export #24 complete"} if then run manually. But doesn't seem to work in a cron job.
Maybe there is no solution... it's very strange I can run the processing URL manually but not in a cron job.
My colleague ran more tests yesterday but the cron jobs didn't run.
She noticed the following:
the customer sets the following for the cron:
0 0 * * 0
this means that the 'trigger' cron will be processed only on Sunday. Can you suggest to her to set to:
0 0 * * *
as wpallimport asks to set 'Fetch this URL every 24 hours:' as described here: hidden link
Yes - because it wasn't working I set to a longer time period. My tests were much more frequent that that. I'm happy if your colleague changes the cron job timings for testing purposes herself (and then perhaps sets back to a longer time period). This might be a better solution so she can set to suit the time she's actually investigating the issue.
The link indicates you can set the period to suit you:
"If you want to run your import every 24 hours, you should run the trigger URL every 24 hours. If you want to run your import once per week, you should run the trigger URL every week."
If she still wants me to set to daily though please do just let me know and I'll do for her, no problem. Lins
My colleague reports that the cron job she set to run at midnight looks to be working, although it didn't export any records because, she surmises, there were no new records to export since the last export.
Basically, can you monitor what happens over the next few days and see whether it works?
Hi, I just logged in to the back end of WordPress (All Export > Manage Exports) to have a look and sadly it hasn't worked (see image).
It should export ALL records and if I manually run the trigger URL first then the processing URL it works fine and would show here a total number of records exported (not 0). And the cron job also does work if I disable toolset.