Can a scheduler be set on submit of a form in wordpress?

It’s wrong to execute wp_schedule_event in plugin activation and cronjob tag. The correct tag to hook is wp. WordPress internal cron system works by “request-response” method, it checks for scheduled events immediately after any request to the whole system, after checking the scheduled events, it loads next parts of the system. So, hooking scheduling to … Read more

How to use a class within a cron job function

You’re calling a function with variables that are not defined and are required for the function to work correctly. function hourly_function() { $newClass = new newClass(); $var1 = ‘this should’; $var2 = ‘work with’; $var3 = ‘some content’; $newClass->newClass_function($var1, $var2, $var3); } You might want to move those variable to a __construct if ( ! … Read more

Wp Maintenance mode and external cron job

You can use the wp_doing_cron() method to determine if the request comes from a cron request or not. if( defined( ‘IN_MAINTENANCE’ ) && IN_MAINTENANCE && $pagenow !== ‘wp-login.php’ && ! is_user_logged_in() && ! wp_doing_cron() ) {

Set a menu item to display during certain times

Since you need to edit theme files, you’ll first want to determine whether you’re using a custom-built theme or something that was downloaded from somewhere. If it was downloaded from somewhere, you’ll need to create a child theme (basically, you just create a new style.css file which only needs to contain comments at the top, … Read more

Any insights into Transient API locking, cron and threading?

How does one go about locking down transient API requests for multiple threading? Has anything done some benchmarking, just how much can the transient API handle for multiple concurrent requests? Under normal circumstances Transients API is essentially thin wrapper on top of Options API. The difference is that (unlike plain options) transients might make use … Read more

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.