Cron event running more than once if triggered from WP Crontrol

I think I solved this issue. The reason seems to be that I had the following cron related constants set in my wp-config.php file: define( ‘DISABLE_WP_CRON’, false ); define( ‘ALTERNATE_WP_CRON’, true ); Since I am using a docker container here, I added ALTERNATE_WP_CRON and when using this we also need to set DISABLE_WP_CRON to true, … Read more

Does DISABLE_WP_CRON prevent plugins from registering new cron tasks?

Is this assumption valid? Or does DISABLE_WP_CRON actually block crons from running, and block plugins from registering new cron events? Yes, setting DISABLE_WP_CRON to true doesn’t actually block WordPress’ crons from running; it just prevents wordpress itself from initiating the events to run when your backend is triggered by a customer viewing your website. I’m … Read more

Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?

The WP_DISABLE_CRON constant only removes WP-Cron from loading on the page so it’s no longer triggered by site traffic. You can absolutely hit the wp-cron.php file directly to trigger it. I use https://cron-job.org to ping my private sites at https://dev.example.com/wp-cron.php?doing_wp_cron for example. This is actually recommended in the WordPress handbook: https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/ Editing to add: if … Read more

How to avoid timeout waiting for output from CGI script?

WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more. By default WordPress is setup to call wp-cron.php everytime someone visits your WordPress website when a scheduled task is present, to … Read more

How to expire guest users after 1.5 hours logged in?

In your single.php template file: <?php if (has_post()) { the_post(); $user = wp_get_current_user(); $hasPermission = in_array(‘subscriber’, $user->roles); // or maybe instead of a role, you can check for your custom permission: // $hasPermission = current_user_can(‘view_access_codes’); $postTime = get_post_time(‘U’, true); $timeThreshold = time() – 60 * 60 * 1.5; $hasTimePassed = $postTime < $timeThreshold; if (!$hasPermission … Read more

how to crate cronjo not depending on user access

Have tried plugins for wordpress cronjob plugins Cronjob Scheduler and SetCron are worthy a shot… my personal favorite is Cronjob Scheduler.. with cronjob scheduler Running your cron tasks Most shared providers offer a crontab manager, or you can speak to your shared hosting provider about setting up our cron job. If you manage the server, … Read more

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