Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [wp-cron]

wp-cron refers to a WordPress subsystem that allows for the scheduled execution of code

0
votes
0answers
12 views

Usage of predefined actions in WP Cron

I have a working wordpress cron, that is executing as expected. Inside the cronjob I want to use the action plugins_loaded. /** * Daily event. */ public function ...
0
votes
1answer
18 views

WordPress CRON job working when reloading the page

I'm Trying to scheduling wp_cron job in my website to send email everyday without opening my website but this is not happening. This work when user come to the website or reload a page. Here is my ...
0
votes
0answers
32 views

Trying to configure cron to get next value from array on each run

So I have this block of code and it is driving me crazy: if ( ! wp_next_scheduled( 'change_quote_hook_short' ) ) { wp_schedule_event( time(), 'one_minute', 'change_quote_hook_short' ); } ...
0
votes
0answers
24 views

How to auto delete posts with specific keywords titled,tagged via cron?

I'd like to automatically delete all posts which contain specific keywords in their titles and tags via cron. How to do?
0
votes
0answers
10 views

WP All Import manual Cron

I am having problem to set up Cron to import stock. In Plugin WP-All Import i have two urls. One which starts import, another one is checking process and if it's stuck it kicks it back on. I'm runing ...
0
votes
0answers
13 views

interrupt hook background job

I am running background job by using add_action hook, hook starts on REST API CALL: if ( ! wp_next_scheduled( 'bg_job_hook' ) ) { wp_schedule_single_event( time(), 'bg_job_hook'); ...
0
votes
2answers
58 views

Cron not sending wp-mail()

I have a problem with a cron schedule function, it does not want to send an email with the wp_mail() function. This is my code: It is placed in the functions.php <?php add_filter('...
0
votes
1answer
26 views

Automatically delete posts one by one depending on published time

How can I delete the posts one by one depending on the published time of the post every 24 hour? Why this snippet deleting all the posts at once, even if they are not published in the same hour or ...
2
votes
1answer
31 views

Why would wp_schedule_single_event get delayed start?

I'm using wp_schedule_single_event to run a function in the background immediately when a logged in user visits the dashboard page. The problem I'm having is that the time between triggering and the ...
0
votes
0answers
12 views

Scheduled cron event removed from list automatically after sometime

I have used two plugins for cron 1) Advance Cron Manager 2) WP Control I have added cron in both plugins, but it removes from queue after some time when there is no activity on website (frontenf/...
1
vote
0answers
180 views

Automatically running Scheduled Actions

Is there a way to automatically run scheduled action (Tools -> scheduled actions). At the moment it says they are 'Pending'. They work fine if I run them manually but I need it to run as soon as my ...
0
votes
0answers
50 views

cron job for custom post type not working since Wordpress 5

Since Wordpress 5.1 (or 5 in general) I have a problem with a cron job. This cron top is filtering expired custom posts (coupon) and will mark it "not reliable" however its not working anymore. ...
0
votes
1answer
12 views

What am I doing wrong creating post draft via wp-cron? (wp_schedule_event & wp_insert_post)

So I've been googling and apparently a lot of people have struggled with this for the past X years and there doesn't seem to be any clear responses on Stack Overflow. What I am developing is a ...
0
votes
0answers
33 views

WP-CRON is not working

my website is running on a ubuntu 18.04 vps and im using nginx i recently noticed that wp-cron is not getting excecuted properly so i installed WP-Cron Status Checker plugin and it shows cURL error ...
0
votes
0answers
11 views

WP Cron regularly causes “Environment health Degraded on AWS”: Happens with HTTP 200 as well as HTTP 500 sometimes

This problem is ocurring regularly and I get dozens of notifications from AWS. Example: Timestamp: Tue Feb 26 17:26:00 UTC 2019 Message: Environment health has transitioned from Ok to Degraded. ...
0
votes
1answer
21 views

Call do_action() within WordPress cronjob

I've programmed a cronjob in WordPress which get's executed every 5 minutes. In the function of the cronjob im trying to perform a do_action: error_log('Send Email'); do_action( '...
0
votes
0answers
29 views

Use a cron job to automatically create posts based on dates

I have a custom post type called cpt1. I need to run a function that on a daily base Loops through cpt1 and then check the dates. This is done by using cron job to trigger. Within this loop ...
0
votes
2answers
31 views

Scheduling WP cron jobs

I am new with cron jobs and I have to schedule cron jobs. There are a lot of cron jobs in my website which are running randomly but I want all these to run at specific time. Actually I do not want ...
0
votes
0answers
39 views

Php cron job (wp-cron) not working

I try to create a php cron job with help of the WP Control plugin. The purpose is to delete all files in the uploads directory for the current year and month. I use this code: $files = glob('./wp-...
0
votes
1answer
21 views

Media Library Latency, Lag, CRON?

When I add images to my Media Library they aren't available in the Media Library for about an hour. It seems like there is a queue or some sort of CRON that fires. The image appears in the media ...
0
votes
1answer
21 views

Automated mark posts as featured every day

Hello Wordpress Community, I want to build myself a "recipe of the day" functionality. I'm looking for a way to mark 3 Custom Post Types per day as "Featured Posts" by a plugin or Cronjob. The ...
0
votes
1answer
89 views

Check if event was scheduled - schedule event only once

I have some programming error in my wordpress plugin. When its running, then it keeps registering cron job to the wordpress. I wrote the plugin as a class: class Cleverstart_Woofio extends ...
0
votes
1answer
38 views

Run function at a specific time of a day

I have tried this solution but I can't get it to work Run function at specific time Here is my example: //this is for testing purposes function my_cron_schedules($schedules){ if(!isset($schedules["...
0
votes
2answers
116 views

Use WP Cron to Clear a Page Cache?

I'm using a plugin (Comet Cache) to save static versions of a particular page I have on my site. Inside the plugin, I have the cache set to clear every 2 hours (that way this page can show the ...
0
votes
1answer
86 views

Most efficient way to trigger wp-cron through system cron.

I have recently decided it would be best if i disable the built in wordpress cron function and move to the system cron which will activate the wordpress cron every 15 minutes. I am wondering which ...
0
votes
1answer
53 views

wp_get_schedule and wp_next_scheduled don't find my scheduled wp-cron job

I have tried the following two approaches, each resulting that the cronjob gets added over and over again, until I remove the code. I literally had it scheduled hundreds of times... if(!...
3
votes
2answers
39 views

WP CRON runs only the first time

Here is my code function cron_add_weekly( $schedules ) { $schedules['seconds'] = array( 'interval' => 5, 'display' => __( '5 Seconds' ) ); return $schedules; } ...
0
votes
1answer
40 views

Where in the page load code is wp-cron triggered?

I just spent way too much time trying to troubleshoot why my wp-cron job wasn't running. It seems, under 4.9.8, the only way to run cron is by calling the wp-cron.php file as a URL. The docs say ...
1
vote
1answer
54 views

Detect if Cron is Running

Many times I have code and I want to make sure it only runs in a cron context, or it never runs in a cron context. Is there an is_cron_running style function?
0
votes
1answer
68 views

wp_set_post_terms not updating with WP Cron Event

I have a jobs board custom post type (job_listings) with a taxonomy (cvl_job_status) attached with various tags assigned, namely; Live, Filled and Expired. Each job post has a custom field (...
0
votes
1answer
29 views

WP_CRON issue with UTC and local time

I have made a plugin to change some user metadata on a schedule according to the wp_cron function. If the current time is say between their lunch hours (that is in their user profile as date('g:i a', ...
1
vote
1answer
91 views

Sync user meta fields using Wp cron job

I'm searching about using wp cron job to sync two user meta fields monthly. I'm using a very awesome plugin called "SyncFields" and it works fine automaticaly, But I'm looking for sync it every month.
0
votes
0answers
106 views

Can run cron event manually with WP-CLI but not with any plugin, unsure if it's being scheduled

I have a cron event that I am able to manually run with wp cron event run --all When I go to my dashboard and go to WP-Crontrol OR Advanced Cron Manager, I can see my event listed and tell it to ...
0
votes
1answer
139 views

Wordpress Cron job, 302 response

I am trying to debug a cron job in wordpress. It's supposed to update user hours but doesn't, and after putting some test statements in the code, I'm not too sure it's even running. I have debug ...
0
votes
0answers
68 views

Cron job cannot use “wp_remote_post”

I've written a script that is running once an hour on my site but it's not working. I've been trying to debug and unfortunately I haven't gotten very far. I'm getting the following error: Uncaught ...
0
votes
1answer
63 views

wp_split_shared_term_batch messing up upgraded ACF 5 data

After upgrading Wordpress and associated plugins to the latest version on a dev server and migrating the source files and database to the production server, the data from ACF is different. prod and ...
0
votes
2answers
69 views

How to Trigger WP CRON at Local Timestamp?

I am trying to schedule WP Cron that should run every midnight at Local Timestamp, but it is taking UTC only. This the code I am trying with, if ( ! wp_next_scheduled( 'midnight_cron' ) ) { $...
0
votes
2answers
182 views

WP cron and update post meta

I try to create a scheduled cron job which runs every hour, Its my first time working with wp-cron. In the cron function, I want to update post meta values, if some conditions are met. I also tested ...
0
votes
1answer
418 views

Wordpress function, Run using Crontab

I have disabled cronjobs on my nginx server, as it is better to run from crontab. define('DISABLE_WP_CRON', true); How could I run a custom wordpress function using Crontab, once per day? This ...
0
votes
1answer
50 views

Cronjob function not executed - negative seconds

I've created a custom function that read an XML file and import it in woocommerce products. The XML files are exported by an external platform every day in the website ftp. I replaced the wordpress ...
1
vote
0answers
40 views

WP-CLI cron on multisite using WP-Toolkit “succeded”, but callback not executed

I'm trying to trigger WordPress crons within a multisite using Plesks WordPress toolkit. Generally it is working, but the callback doesn't seemed to be executed. The command to execute crons: /...
0
votes
1answer
68 views

Wordpress cronjob get scheduled but function does not run

I am trying to schedule wordpress cron job having dynamic hooks. I am developing a plugin and the cron jobs are to be scheduled dynamically. I need a way to name the hooks that directly corresponds to ...
0
votes
2answers
76 views

How to make sure WP-CRON job loops through all posts?

I am using WP-Crontrol and have some CRON jobs running daily to check the age of the posts. If the post is 2 days older, they will be deleted. This works but for some reason, only some of the three ...
3
votes
2answers
272 views

WP Cron - Run Cron after evey 15 minutes at a specific time for the next three hours

In WordPress I want to schedule an Event which will run my function (hook) at a specific time (let's say at 6PM) and then it will run again after 15 minutes (means at 6:15 PM) and keep running after ...
0
votes
0answers
25 views

Add lines to wp-config.php file for disabling wp cron job automatically

Is it possible to add lines to wp-config.php with some codes inside theme (like may be on theme activation) i want add the below code without editing the wp-config file manually define('...
1
vote
0answers
159 views

cron.php being constantly deleted [closed]

I have a problem with a WordPress installation (even a fresh one), one and only one server. The cron.php file is being deleted in a random time. The site had an infection but it was reinstalled ...
1
vote
1answer
18 views

Is there way to run a code every time when any cron is run?

publish_post is an action triggered whenever a post is updated and its new status is "publish". Is there similar action which is trigger when cron is run including WordPress default crons? I am ...
2
votes
0answers
42 views

Scheduling posts on wordpress adds wrong seconds as post_date

When scheduling a post in wordpress, e.g. 15:50, I always see that as time there are always seconds added at the end, e.g. 15:50:48, which ruins my cronjobs and makes them run 1 minutes later (if I ...
8
votes
1answer
476 views

How to make sure that only one wp_cron() runs at a time?

I have around 20 wp_cron() functions like the following code. Almost all crons run hourly; a few are daily. if ( ! wp_next_scheduled( 'my_task_hook' ) ) { wp_schedule_event( time(), 'hourly', '...
0
votes
0answers
99 views

WordPress Multisite cron jobs using cron tab

U have a WordPress multisite install with subfolders. U'm trying to set up cron jobs. I know I can setup for each site with, HTTP_HOST=sub.example.com php wp-cron.php > /dev/null But this doesn't ...