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 [cron]

The tag has no usage guidance.

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
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', ...
0
votes
1answer
12 views

Call a PHP file from Cronjob

I'm using the MEC Events Calendar. I am trying to auto sync my events to Google Calendar. Here is what the event plugin says: Important Note: Set a cronjob to call /www/wp-content/plugins/modern-...
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
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' ) ) { $...
2
votes
1answer
55 views

Updating WooCommerce variable product stock issue

Soo.. I've created CRON script, that each 1 minute retrieves an actual stock systems data, converts it for Wordpress/Woocommerce database table and updates stock. On database side everything looks ...
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 ...
1
vote
0answers
23 views

Add cron schedule to upload video on save_post

I made a custom plugin to get post data from another source, when I save a post, I get all data. and also upload a video from source server to our server. But it take a while when saving post until ...
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 ...
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
31 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 ...
0
votes
1answer
38 views

Run a Change Role Cron Job on WordPress via cPanel

Can someone point me in the right direction here? I'm attempting to set up a plugin that sets up a cron job on activation to change the user_role of a user after 3 months of their user_registered ...
0
votes
2answers
307 views

How do I get a Function in my functions.php to execute with a cron job?

I have a function in my functions.php file that is supossed to update my post status once the expiry date has passed. I call this function in a test.php file that is also a template page with url /...
1
vote
0answers
35 views

Problem with automatic role change through cron job

I have a function called by a daily cron job that automatically changes the role of users after a period of time. The 1st role update should happen 120 days after registration, and a 2nd role update ...
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. ...
2
votes
1answer
91 views

Safe to set permissions to 757 temporarily to update via wp-cli?

LEMP stack on digitalocean VPS. I haven't been able to get "wp core update" to work unless public (or "Other") has execute permission, i.e. 757 or 777. Otherwise, it throws "Error: Could not create ...
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 ...
0
votes
0answers
21 views

unix cronjob for wordpress does not stop running

So i disabled wp-cron, and added one in my crontab. define('DISABLE_WP_CRON',true); */45 * * * * /usr/bin/php -q /var/www/html/wp-cron.php >/dev/null 2>&1 This works fine, but every so ...
1
vote
1answer
20 views

Loading WordPress Admin Environment

I am using the following library to create custom posts: https://github.com/HarriBellThomas/Wordpress_PostController It works perfectly, however I wanted to use it as stand alone custom_post.php file ...
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 ...
1
vote
0answers
38 views

How refresh wp_schedule_event without restart a plugin

I create option page for set optional recurrence (daily or hourly wp_schedule_event, when I change for example, from daily to hourly through option page in back-end, how can I fire wp_schedule_event ...
0
votes
0answers
15 views

New database entry to trigger runing PHP/SQL query through link with token, without logging into the website

I want to do particular verification process for my wordpress users, and I want to know if it is even possible, before I spend any more time trying. This is what I have in my WordPress so far. My ...
0
votes
0answers
227 views

How to add a cron job in my functions.php

My host is WPengine, I can't configure my crontab directly on the server so I need to do it on my side. Then I need to add a function to my functions.php right? What is the function to be sure that ...
1
vote
1answer
71 views

Automatically update custom field in all posts of a custom post type

I have a custom post type ("fecha") that contains past events (birthdates of famous people, historical dates, etc). Within these posts, a custom field ("aniversario") calculates how many years have ...
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
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
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
1answer
69 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. ...
0
votes
1answer
43 views

What is the best practice to set and update Transient value of API data in every minute?

In one of my site, i am using the SERVER cron to get the data from the third party API vai CURL every minute and run the set transient function. It is working fine most of the fine. But when there are ...
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
278 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
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
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
116 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 ...
0
votes
2answers
91 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
198 views

Cron job script - loading wordpress system fails

I want to run a cron job that fetches data from an api and stores it in a database table. I don't use "wp-cron". I load a script in a folder inside the theme. But I need to load the wordpress system ...
0
votes
2answers
24 views

Plugin scheduled event not working

I have created this interval in my functions.php: function minute_interval( $schedules ) { $schedules['minute'] = array( 'interval' => 60, 'display' => __('Every minute') ); ...
0
votes
1answer
55 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
56 views

Cron on plugin in multiple WP installations; common plugins directory

I have multiple WorpPress installations on a single domain (I do not want to use a network install), with a common /wp-content/ directory defined as follows in each config.php file: define('...
1
vote
1answer
137 views

System Cron job not firing

I am new with WordPress development and using cron job for first time. I am having issue with cron job which is not firing. Here are all steps i have taken to achieve this. I have put this line in my ...
1
vote
1answer
390 views

Why?: hundreds of empty files named wp-cron.php?doing_wp_cron.<digit>

In the home directory of the nginx user I have hundreds of empty files named wp-cron.php?doing_wp_cron. So my questions are why...? can I delete them...? . and how do I stop then regenerating? ...
0
votes
0answers
29 views

Cron job emails blank

Was just wondering if anyone could throw some advice my way? I have a site setup on SiteGround and have turned off the internal WordPress cron as this was hitting the server resources fairly hard. I ...