Questions tagged [cron]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
27 views

Server cron job not working

I want to setup server cron job for my WordPress website. This is what I have done so far. I added this line to my wp-config file. define('DISABLE_WP_CRON', true); I added this command for setting ...
0
votes
0answers
17 views

delete cronjob events with no action (wp-control)

I am quite new to Wordpress Cronjobs. I deactivated the wp-cron function via wp-config.php and set a server cronjob to run wp-cron.php To add new cronjobs, i installed the wp-crontrol plugin. I was ...
0
votes
0answers
24 views

WP Cron intervals multiple times a day?

I would like to run a custom interval for a cronjob where it runs every day at 5 minutes after 6am, 10am, 2pm and 6pm. The timing for this on a crontab would be 5 6,10,14,18 * * * However I'm stuck ...
0
votes
1answer
26 views

my hook or my function wont run in the cronjob

i have made a cron job to run a function but the function wont run. i did run the code that is inside the function, outside to see if it works and it did, it just wont do nothing if inside the ...
0
votes
0answers
8 views

Cron: Run PHP script with functions of WP plugins

I need to run a PHP script at a specific time (so no wp-cron) and it needs functions from a custom WP plugin. How could I accomplish that? Ps. I can't install any external libraries but I am able to ...
0
votes
0answers
21 views

execute cron jobs when .htaccess login protected?

My client is not able to execute cron-jobs in his wordpress dashboard because he gets 401 not authorized. This is because he has an .htacess file blocking normal access to the site (it's a member ...
0
votes
1answer
10 views

Cron job shedules replace?

I was watching this: Wp_Schedule_Event every day at specific time and im wondering if I do the following will it replace all my schedules? function myprefix_custom_cron_schedule( $schedules ) { $...
0
votes
0answers
14 views

WP-Cron: Cannot execute crons on servers without registered domains

My test environment does not execute WP-Crons properly because cURL can't connect to the "fake" domain. I'm using WP 5.23 on an NGINX server without a registered domain (by editing my hosts file). ...
1
vote
0answers
19 views

wp_schedule_single_event not working: cron job is triggered but nothing gets executed

I'm trying to execute a piece of code asynchronous. I tried to use wp_schedule_single_event like this in my WP plugin: function my_async_test(){ $fp = fopen(wp_upload_dir()['basedir'] . '/log.txt', '...
0
votes
1answer
32 views

How to Schedule Cronjobs for start of every month and year

I have been trying to run a function at first of every month, and first of every year. And i wanted to run at 12am exact. Below I have shown the function. When is schedule it for daily it works ...
0
votes
0answers
21 views

wp-cron event doesn't run when custom login API is enabled

I have a cron job on my wordpress site. which I would like to run every hour. I also have a custom login function on my site: users are directed to my site via another site which passes login ...
0
votes
0answers
21 views

CRON job to update wp_usermeta value each day or week based on server time

My Wordpress site has a registration field that asks members how many weeks pregnant they are. If a member insert 5 then 7 days later that integer needs to increase to 6. Pseudo code for what I ...
0
votes
1answer
76 views

wp delete duplicate entries of custom post types every 15 minutes

looking for some assistance. I have searched the usual sites but not come across this specific question and was wondering if anybody could help. I have a scrape system that collects data and saves it ...
1
vote
1answer
43 views

Issues When Recursively Calling wp_schedule_single_event()

I run a site where I make an external API call. I want to have a failure case such that, if the API call fails, it will call wp_schedule_single_event() to re-try the API call in +4 hours. If that ...
0
votes
0answers
17 views

How would this wp cron schedule run?

I have my linux cron set to run every two minutes */2 * * * * wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 Then I have my cron function written like this: // ...
0
votes
0answers
30 views

How to auto delete posts with specific keywords titled,tagged via cron?

I'd like to automatically delete all posts which contain specific keywords in their titles and tags via cron. How to do?
0
votes
0answers
42 views

WP All Import manual Cron

I am having problem to set up Cron to import stock. In Plugin WP-All Import i have two urls. One which starts import, another one is checking process and if it's stuck it kicks it back on. I'm runing ...
0
votes
2answers
318 views

Cron not sending wp-mail()

I have a problem with a cron schedule function, it does not want to send an email with the wp_mail() function. This is my code: It is placed in the functions.php <?php add_filter('...
1
vote
1answer
97 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
1answer
69 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
14 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
41 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
57 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
23 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
308 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
221 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
69 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
60 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
41 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
58 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
1answer
238 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
2answers
137 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
970 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
728 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
50 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
70 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
122 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
165 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
96 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
2k 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
50 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 ...
2
votes
1answer
490 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
346 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
19 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
53 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
30 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
21 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
180 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
143 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
23 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 ...