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

Questions tagged [wp-cron]

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

0
votes
1answer
19 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
43 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
14 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
18 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
58 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
19 views

Editing cron timestamp in wp_option table

Let's say I have a multisite with ~1000 blogs. One of the plugins triggers an action once a day using wp_cron. The issue is that this triggers on all sites at around the same time, slowing down the ...
0
votes
0answers
17 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
31 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
25 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
36 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
36 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
30 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
32 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
24 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
31 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
18 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
28 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
32 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
159 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
38 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
22 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
87 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
32 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
323 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
41 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
67 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
25 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
293 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
163 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
33 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
193 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
122 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
118 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
49 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
38 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
307 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
70 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
35 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
72 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
279 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
34 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
57 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
529 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
40 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
604 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
170 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
117 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
147 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 ...