WP Cron is “half-failing” to insert posts

I just encountered this very same problem. I was trying to do wp_insert_post() from within a cron action, and the script would apparently just die during some save_post action handler. I tracked down my problem, which turned out to be a save_post handler which is used to save the POST data from a custom metabox. … Read more

WP Super Cache All Pages [closed]

Plugins such as WP Super Cache have a setting for that. It’s called “pre-load”, it allows you to pre-load pages and you can set an specific interval to regenerate cache. If you publish at least 3 or 4 times a week a good configuration could be every 4000 minutes.

Template Tag not available in real Cron Jobs

When you run things on the CLI (which is pretty much where Cronjob and runwhen jobs are running), then you don’t have access to some things like some server or request variable contents, etc. What you need to do is fire up WP Core. Else you won’t have access to the full WP API. One … Read more

Web Scraping with Cron

You don’t necessarily need to use the WP Cron API for this. Instead you could modify your existing code to make use of WP Transients. Transients are basically Options that expire after a set time. You can wrap your current scrape process in an if statement that checks for the existence of the stored transient. … Read more

WP Cron job every 1st and 15th of the month

wp_cron operates on intervals and there is no interval that will hit exactly the first day and the 15th of every month. You could run your wp-cron job every day and check the date, similar to this but with a simple callback like: cron_callback_wpse_113675() { $date = date(‘d’); if (’01’ == $date || ’15’ == … Read more

Cronjob returns a lot of REMOTE_ADDR, SERVER_PORT, SERVER_NAME, etc errors

You’re getting Undefined index errors because you’re loading the files directly and not rendered through the server. The server typically populates those values and it’s actually more secure to run with less elevated privileges (through an HTTP request). Throw your manual cron to a curl or wget — whichever you have installed on your server. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)