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

The tag has no usage guidance.

0
votes
0answers
5 views

Update CPT post meta with update_post_meta and cron job

I'm attempting to regularly update a custom field ($company_rating) in a CPT with update_post_meta(). The cronjob is assigned and working. I've tested the function and it prints correctly (I've ...
1
vote
0answers
9 views

How to bypass maintenance mode with external cron?

I'm using crontab to run a php script loaded with wp-load.php with absolute path. However, when I go to maintenance mode, the file can't run. I'm using Coming soon plugin. Is there a way to exclude ...
0
votes
1answer
11 views

Schedule an action callback

I have a function in which I want to send out emails of expiring account. Is there a way of scheduling a "doaction()" or similar. What I want is this: doaction('Something here', ...
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
18 views

Help with a cron job query on WordPress CTP

I have got a custom post type called reminders. It has the following meta boxes. description specific date It is allocated to a specific user I would like to know how to go about creating a cron ...
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

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
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 ...
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; } ...
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
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', ...
0
votes
1answer
24 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
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
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' ) ) { $...
2
votes
1answer
450 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
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 ...
1
vote
0answers
33 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
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 ...
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 ...
0
votes
1answer
52 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
829 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
40 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
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. ...
2
votes
1answer
212 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
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 ...
0
votes
0answers
22 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
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 ...
1
vote
0answers
68 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
17 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
267 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
80 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
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
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 ...
0
votes
1answer
46 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
113 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
58 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
45 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
95 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
427 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
59 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
192 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
158 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
190 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 ...