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

2
votes
1answer
13 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
10 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
27 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
28 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
10 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
15 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
10 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
15 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
23 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
29 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
32 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
18 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
18 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
52 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
22 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
84 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
33 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
24 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
36 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
28 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
50 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
42 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
26 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
81 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
86 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
93 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
53 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
55 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
54 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
125 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
257 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
42 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
35 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
54 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
59 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
231 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
56 views

WP Cron JOb - Publish Post when URL is available Else Schedule a new Cron Job

I wanted to achieve the following. I will create cron job in wordpress (i am using wp_schedule_single_event) The callback function of hook will check if URL (which i will provide) is available. ...
0
votes
0answers
23 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
145 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 ...
7
votes
1answer
425 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
82 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 ...
0
votes
0answers
108 views

Run external file cron using WordPress Scheduler

I am using a WordPress store where I am importing products and categories from external API. Procedure for each files have created in external files. Earlier I used cpanel to assign those crons like ...
0
votes
0answers
36 views

If planning a new post, each URL gets a “/?doing_wp_cron=1234…”

unfortunately I realise that each URL from my wordpress site (actual WP version) gets a "/?doing_wp_cron=1234..." at the end if I planned a new post for public it some times later. What could cause ...
1
vote
0answers
660 views

WordPress Cron is scheduled but not running

I'm writing a plugin that uses WordPress Cron. Here the code I am using to add and remove the cron event. On plugin activation it creates the cron event, and on plugin de-activation it removes the ...
0
votes
1answer
352 views

Setup wp_schedule_event within a custom plugin

I am using WordPress 4.9.6 and I am trying to create a plugin that pulls data from an external API. See below my current code: myPlugin.php <?php /** Plugin Name: myPlugin description: Get Data ...
0
votes
0answers
37 views

Plugin with functions inside a class & how to trigger WP CRON

Another developer has created a plugin for me that imports some data from an XML feed, before it imports it runs a function that deletes the existing items, then runs the import function. These both ...
0
votes
1answer
368 views

How to use wp-ajax in wp-cron

I have create a custom wordpress plugin where i am using wp ajax. In class's __construct i have an action (admin_footer) in order to use wp_enqueue_script and wp_localize_script following wp ...
0
votes
2answers
127 views

Better way to run heavy scripts using WordPress database

I am going to make plugin, collecting post views from Google Analytics. The main idea is to get views per post and store them with post meta. Problem: My blog has a lot of posts and google analytics ...