Stack Exchange Network

Stack Exchange network consists of 174 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

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

0
votes
2answers
26 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
16 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
21 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
18 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 ...
0
votes
0answers
16 views

Question regarding Post Scheduling

First i want to say that my wordpress site is a daily verse website and everyday i have always 1 post. But since i just started the website i do not have visitors yet to trigger the wordpress cron and ...
1
vote
0answers
28 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
0answers
14 views

WP cron job code

i want to set cron job but i dont actually know where to put my code to be checked on every page visit? This is done with sage framework and i want to set cron, just dont know where to put the code. ...
0
votes
1answer
23 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
25 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
118 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
29 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
20 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
53 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
29 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 ...
6
votes
1answer
302 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
30 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
39 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
21 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
121 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
102 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
29 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
136 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
121 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 ...
0
votes
1answer
95 views

wp-cron and execution of code in is_admin() included script

I am developing a plugin. Among other things its backend settings will allow admins to update a site data file from a 3rd party data provider, or to switch on/off a wp-cron job to do this ...
1
vote
1answer
42 views

Use wp_set_post_terms() instead of wp_insert_post()

Since I use cron jobs for automation I ran into some problems with the taxonomy. Before I used the cron job, the following code used to work: $custom_tax = array( "project-type" => array( ...
0
votes
1answer
36 views

Code does not work in class implementation but works fine in functions.php file

I am trying to clean up my codes and separate them in class files. I have this block of code that works perfectly fine where it sets the status of events older than a week to trash when I add it in ...
0
votes
0answers
260 views

Constant WP_CRON_LOCK_TIMEOUT already defined in /htdocs/wp-config.php

I got this PHP error : Notice: Constant WP_CRON_LOCK_TIMEOUT already defined in /htdocs/wp-config.php on line 195 I don't understand because when I do a search in the wordpress project with the ...
0
votes
1answer
58 views

Use cron to create a non blocking task

I'm writing a plugin which collects a pretty large feed. From each feed item a custom post will be created. The feed can also contain images for each item that is uploaded from the remote url. ...
1
vote
0answers
27 views

How does task scheduler plugin implements cron that is not dependent on page load request? [closed]

I have been looking at task scheduler Plugin that claims to run cron task at a fixed interval without depending on page load request. Can anyone help me understand how it does the same?
1
vote
1answer
60 views

Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?

I am developing a WordPress plugin and wants to run a background task that calls an API and updates database table. Now, the API can only give results for 5 DB entries in one go and for 500 entries in ...
2
votes
1answer
232 views

Does wp-cron runs all tasks scheduled at same time together or one after other?

I am developing a plugin and want to add a cron task(let's say cron_task_test) but have a doubt. In case 15 tasks(they may be scheduled by multiple plugins or the user himself) are scheduled to run at ...
1
vote
0answers
32 views

WP CRON duplicate wp_insert_post with has < and > tag

When I trigger the CRON job to insert all the MovieTitle, all the MovieTitle with the < and > tag, will insert more duplicates. but if run this through the plugin itself works fine. Any solution ...
1
vote
0answers
55 views

wp-cron behaviour when there are multiple queued tasks

Ive experimenting with using a server side cron to execute wp-cron instead of Wordpress, as suggested by countless articles. What I don't quite understand is how wp-cron is supposed to deal with ...
1
vote
1answer
514 views

What is minimum time interval for which a cron be scheduled?

What is the minimum time interval for which a cron can be scheduled? Is it 1 second or a minute?
1
vote
0answers
34 views

How to make a implement queue for scheduling tasks in WordPress?

Is it possible to implement some queuing mechanism for task scheduling? In my plugin, I want to run a task triggered by cron for 5 seconds and if not complete, save the state and call another Async ...
1
vote
1answer
489 views

How to run multiple Async HTTP requests in Wordpress?

In my plugin, I want to call 10 or more HTTP requests asynchronously in WordPress so that I need not wait for the response of anyone. Is there any way in Wordpress that supports this and also ...
1
vote
0answers
162 views

How wp-cron can run in background if PHP is single threaded?

I read that wp-cron runs when a page load request comes. So, if PHP is single threaded how can all the cron jobs run as a separate task? If that's not the case, may anyone please help to understand ...
1
vote
1answer
102 views

Will cron job run if page loaded is being served from cache?

As a cron job does not run until a page load request comes, what will happen in case page-loaded is being served from cache by some caching plugin? Will WordPress still run a cron job that is ...
1
vote
1answer
116 views

How to schedule a cron job in plugin without waiting for page load request?

I want to schedule a cron job from my plugin using wp_cron but came to know that it only checks for cron only on page load. Is there any way to run a cron job even if the page is not loaded? Since I ...
0
votes
0answers
82 views

wp_schedule_single_event() wont accept argument

Like the title says, wp_schedule_single_event() will not accept an argument no matter what I do. function test($arg1) { return ($arg1); //wp_die($arg1); } add_action('test', 'test'); //...
0
votes
0answers
132 views

Why is `wp_unschedule_event` not working

I have following code. wp_clear_scheduled_hook and wp_unschedule_hook are working when uncomment them. But wp_unschdule_event is not working. Why? public function __construct() { ...
0
votes
2answers
76 views

How to create and run cronjob in WP without using the plugin?

I have a problem I'm wondering, need someone to help. I am doing a function that sends email to followers weekly and monthly. Currently, I have written a function to use, but one thing is I do not ...
0
votes
0answers
18 views

wordpress cronjobsin woocomerce

Can I use wordpress "wp_cron.php" functions in my woocomerce payment gateway plugin to update the status of orders every minute for example? I tried to add this code inside "functions.php", put it ...
0
votes
1answer
51 views

Switch from wp-cron to a server cron job

I'm creating a wordpress plugin that trades cryptocurrencies. It's a bot and I need to check the currency values every 10 seconds. In order to do that I need to run a PHP script through a cron-job. I'...
0
votes
0answers
180 views

How to disable or exclude caching for wp-cron.php* in managed wordpress?

How to disable or exclude caching for wp-cron.php* in managed wordpress ? Due to caching, importing through cronjob is not working. Is there any plugin or option which can clear cache whenever ...
3
votes
1answer
372 views

Problem creating cron job wordpress

I'm currently trying to create a wordpress plugin where i can trade bitcoins. I should create a cron job where I want to check a value I get from some API calls, but my cron job isn't activating ...
0
votes
0answers
409 views

WP-Cron system doesn't work on server

In my current WordPress project I get the following error message when I view my cronjobs: There was a problem spawning a call to the WP-Cron system on your site. This means WP-Cron events on your ...
0
votes
1answer
31 views

Should I have a single cron job that loops the users, or one for each user?

I'm working on a website which only registered users can access, and they are manually added to the site, since there is no registration enabled. Think of it as a private shop. The number of users is ...
0
votes
1answer
195 views

Custom recurrence not working / Wp Cron event

I created a wp cron event with a custom interval of 5 minutes, but it is only executed hourly instead of every 5 minutes. (The callback is properly executed.) The DISABLE_WP_CRON constant is set to ...