Questions tagged [wp-cron]

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

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

Real cron killed my cron system. Only define( 'ALTERNATE_WP_CRON', true ); works

my host recommended me to disable wp cron for a real cron due to excessive executions. the cron system broken immediately and scheduled tasks were not happening. deleting real cron and turning on ...
0
votes
0answers
16 views

wp-cron.php not being triggered by wp_remote_post in spawn_cron()

I am trying to debug failing publication of scheduled posts. On a completely new wordpress installation, (using the default docker image), scheduled posts fail to get published when the correct time ...
0
votes
0answers
17 views

change time interval of scheduled woocommerce cron job

Since woocommerce version 3.4 it is possible to anonymize order data either manually or via a scheduled interval (Days / Weeks / Months / Years). Now I would like to customize the interval to twice ...
1
vote
1answer
91 views

Why is wp-cron only executing on page visit?

As I have understood wp-cron runs after a HTTP-Request to the given domain. Can someone explain to me why this is the case? I don't quite understand why the execution of (scheduled) wp-cron events are ...
0
votes
0answers
30 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
11 views

How to execute/run a JavaScript file everyday

I am working with the https://www.themoviedb.org/ API to fetch data tv shows. For tv shows under "Airing today", I need to update those shows every day.I have implemented data fetching and saving to ...
0
votes
1answer
32 views

Auto Draft Specific Categories Posts after a certain number of Days

I want to put posts from two categories to automatically draft after the number of days like 90 Days from the date of Publish and I created a function with the help of some codes in other forums, but ...
0
votes
1answer
9 views

Schedule several instances of the same action with cron

I have a simple cron job set up in wordpress: add_action( 'event_hook', 'do_this_function'); wp_schedule_single_event( time() + 300, 'event_hook', array('testvariable') ); I use the function ...
1
vote
1answer
21 views

Scheduling a cron job from a function that is ran outside functions.php?

I have a very simple function and hook registration in my functions.php, like this: function do_this_thingy(){ // I am sending myself some simple admin report mails, tested & works } ...
0
votes
1answer
15 views

Unknown requests on my WP Site

I am using ipstack to receive some geo details from my visitors. The free version allows 10.000 requests per month and according to them I have reached 75% of those already. I have never ever had 7....
0
votes
0answers
34 views

wp_schedule_event doesn't work

I wrote a plugin which now needs a daily scheduled event. For testing purposes I've written an hourly scheduled event. class MyPlugin { public function __construct() { add_action('...
1
vote
1answer
23 views

Create cron job for update translations automatically

I would like to set cron job in WordPress with WP Crontrol for update translations automatically. If I saw it right I have to create a PHP code (simple plugin) and then schedule it with mentioned ...
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
8 views

What is sensible way to schedule an email/notificatoin to be sent at specific time?

I have a wordpress site I am working on for administering guitar lessons. As part of my weekly lessons, I have a live video chat. I would like to send a notification one hour before the chat starts. ...
0
votes
1answer
23 views

get_posts query results out of order but shows correct in php snippets plugin

I have a small plugin made for a custom site where a new word is to be picked via wp cron . The oldest (lowest ID #) custom post type should be selected in get_posts and returned. However, it always ...
0
votes
0answers
7 views

How to Schedule (run) another Cron Schedule inside of a Cron Action

i am using this code to run a daily normal checkup cron... but i have another cron which will happen every ten minutes and update each user record according to my condition... but how do i run a new ...
0
votes
1answer
24 views

Run cronjob with browser request

Open the wp-cron.php page into the browser, eg. opening this url http://example.com/wp-cron.php?doing_wp_cron run the cronjob or WordPress block request made by browser?
1
vote
2answers
75 views

Trigger background job using AJAX

I need a second opinion and a sanity check if the solution I'm trying to implement will work. I need to implement a way to run a script that would otherwise be blocking if I would run it using just ...
0
votes
2answers
34 views

When does wp-cron fire?

Where in the WP load order does wp-cron fire? I cannot seem to find this information, and I need to know if I need hook into specific other actions, or not.
0
votes
0answers
17 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). ...
0
votes
1answer
12 views

post_exists stops working in a scheduled event

I am creating a wordpress plugin that takes an article from one of my wordpress sites and then posts it to different wordpress site. For testing purposes, I want it to pull an article at random and ...
0
votes
0answers
27 views

Do WP-Cron events run simultaneously if scheduled for exact same time?

I've noticed that some wp-cron events might be scheduled for the EXACT same time. i.e. wp_update_plugins() 2019-09-29 15:42:54 (5 hours 23 minutes) wp_update_themes() 2019-09-29 15:42:54 (5 hours 23 ...
0
votes
1answer
48 views

get_users(); Is an Undefined Function When Used in Cron Job

I am Using a Wordpress cron to update some usermeta of each user every 24 hours. For which i created a cronjob using the interface provided by my hosting provider. The Cron runs, but the code cannot ...
1
vote
0answers
20 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
35 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
0answers
27 views

Update post status from “publish” to “trash” prior to year 2018

I want to update all posts with status from published to trashed or delete permanently. whose published date is 2018 and previous using WordPress cronjob. Example: If I have 209085 posts, 500 posts ...
0
votes
1answer
39 views

Scheduled post delete - can't pass the cron arguments

Thanks to everyone who takes a look. I've spent countless hours trying to make this work, but no matter what I tried it still doesn't work. Hopefully I'm missing something simple, but I'm stuck... ...
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
19 views

Old content revision: send email notification to author on the 'Review Date'

I'm trying to find a way to configure email reminders for authors to manually review content. Here are my requirements: All pages, posts and CPTs should have the 'Review Date' field. It will probably ...
0
votes
1answer
30 views

Trigger WP CRON from a date in a Custom Field?

I have Custom Post Types which have a vanilla 'date-picker' for each post. My Custom Posts are actually events that are always in the future. I'd like to know if I can somehow trigger an alert when ...
0
votes
1answer
35 views

Convert post type to another

I am designing a website intended to list local events. Ideally registered users would be able to upload new events from the front end and the website would display all the upcoming events in ...
0
votes
0answers
24 views

Execute code at the end of each quarter of year

I need to execute a script once every time we reach the end of a quarter (30th of March, 30th of June, 30th of September and 31st of December. I've found wp_schedule_event on the documentation (https:...
0
votes
0answers
13 views

Usage of predefined actions in WP Cron

I have a working wordpress cron, that is executing as expected. Inside the cronjob I want to use the action plugins_loaded. /** * Daily event. */ public function ...
0
votes
1answer
48 views

WordPress CRON job working when reloading the page

I'm Trying to scheduling wp_cron job in my website to send email everyday without opening my website but this is not happening. This work when user come to the website or reload a page. Here is my ...
0
votes
0answers
34 views

Trying to configure cron to get next value from array on each run

So I have this block of code and it is driving me crazy: if ( ! wp_next_scheduled( 'change_quote_hook_short' ) ) { wp_schedule_event( time(), 'one_minute', 'change_quote_hook_short' ); } ...
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
43 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
0answers
18 views

interrupt hook background job

I am running background job by using add_action hook, hook starts on REST API CALL: if ( ! wp_next_scheduled( 'bg_job_hook' ) ) { wp_schedule_single_event( time(), 'bg_job_hook'); ...
0
votes
2answers
332 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('...
0
votes
1answer
30 views

Automatically delete posts one by one depending on published time

How can I delete the posts one by one depending on the published time of the post every 24 hour? Why this snippet deleting all the posts at once, even if they are not published in the same hour or ...
2
votes
1answer
70 views

Why would wp_schedule_single_event get delayed start?

I'm using wp_schedule_single_event to run a function in the background immediately when a logged in user visits the dashboard page. The problem I'm having is that the time between triggering and the ...
0
votes
0answers
16 views

Scheduled cron event removed from list automatically after sometime

I have used two plugins for cron 1) Advance Cron Manager 2) WP Control I have added cron in both plugins, but it removes from queue after some time when there is no activity on website (frontenf/...
1
vote
0answers
1k views

Automatically running Scheduled Actions

Is there a way to automatically run scheduled action (Tools -> scheduled actions). At the moment it says they are 'Pending'. They work fine if I run them manually but I need it to run as soon as my ...
0
votes
0answers
101 views

cron job for custom post type not working since Wordpress 5

Since Wordpress 5.1 (or 5 in general) I have a problem with a cron job. This cron top is filtering expired custom posts (coupon) and will mark it "not reliable" however its not working anymore. ...
0
votes
1answer
34 views

What am I doing wrong creating post draft via wp-cron? (wp_schedule_event & wp_insert_post)

So I've been googling and apparently a lot of people have struggled with this for the past X years and there doesn't seem to be any clear responses on Stack Overflow. What I am developing is a ...
0
votes
0answers
20 views

WP Cron regularly causes “Environment health Degraded on AWS”: Happens with HTTP 200 as well as HTTP 500 sometimes

This problem is ocurring regularly and I get dozens of notifications from AWS. Example: Timestamp: Tue Feb 26 17:26:00 UTC 2019 Message: Environment health has transitioned from Ok to Degraded. ...
0
votes
1answer
33 views

Call do_action() within WordPress cronjob

I've programmed a cronjob in WordPress which get's executed every 5 minutes. In the function of the cronjob im trying to perform a do_action: error_log('Send Email'); do_action( '...
0
votes
2answers
43 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 ...