Questions tagged [wp-cron]
wp-cron refers to a WordPress subsystem that allows for the scheduled execution of code
441
questions
0
votes
0
answers
7
views
Cronjob problems - Too Many Redirects? [closed]
I'm having a really strange issue with my website. I noticed a lot of cron jobs stacking up in the Status tab of WooCommerce.
After installing WP Crontrol to check the Cron jobs it says the following ...
0
votes
1
answer
38
views
Scheduling an event inside plugin class is not working
wp_schedule_single_event is not firing.
I wrote a function that is posting to external API, if it failed I schedule the same posting function to run 5 seconds later in cases of timeouts.
Here's the ...
0
votes
1
answer
81
views
When running WordPress Cron manually, it shows WP-Cron spawning is disabled. What is WP-Cron spawning?
I use Ubuntu 20.04 LEMP stack VPS. In this server, I run 13 WordPress sites. Every 10 minutes I have set up to run each site cron job with a 20 seconds interval. So every site does not execute cron ...
0
votes
1
answer
19
views
How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
I created a custom plugin and I need to schedule add_action using Crontrol Plugin, the Setup class is from different php class. But the schedule action cant read the Crontrol even if I execute ...
3
votes
0
answers
52
views
Is doing_wp_cron a necessary query string when scheduling cron.php as a cron job?
I have seen various ways to schedule the WordPress cron so that it is triggered by the server. Some will run the php file directory from the crontab and others will use a wget and reference the url. I ...
0
votes
0
answers
28
views
Delete all posts with a specific custom field using meta_query
I'm building a listings website using WooCommerce.
A listing is either set to live or sold inside of a custom field key status
Once a listing is sold then the custom field status is updated with sold. ...
0
votes
0
answers
17
views
Delete all users when they don't update profile_fields
I create a profile_fields named name, when users sign up for an account they will receive an email containing the nickname.
When the user logs in, there will be a page to enter profile_fields (name), ...
0
votes
1
answer
38
views
Auto Delete Users (auto_delete_users)
I need some help cause I couldn't find any solution for my problem and haven't the knowledge to solve the problem on my own.
What I'm trying to do:
I want to delte every WordPress user (subscriber) ...
0
votes
0
answers
35
views
Can/should we delete wordpress cron jobs with no action?
I find myself during a website creation where I try several plugins and delete them afterwards. However, some plugins do not clean their cronjobs and are left to be executed with no action.
My ...
0
votes
0
answers
13
views
i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
I used the default from the documentation to create a custom cron intervals in a custom plugin payment gateway:
I added in the construct the line: add_filter( 'cron_schedules', array( $this, '...
0
votes
1
answer
15
views
Email alert with wp_cron and wp_mail if new data (external API) - Pseudo code
I would like to check twice daily if there is some new data published and send me an email if this is the case.
In pseudo code here what I thought I could do:
Get new list of movies (external API ...
0
votes
1
answer
55
views
How to run wp_insert_post() & wpdb on the background?
I have created a code to fetch data from a remote API then echo certain data & import those data into a post type using wp_insert_post() & post meta** using wpdb->query().
Here's my current ...
0
votes
1
answer
35
views
WP Cron scheduling doesn't work reliably on hosted server
The following code is part of a save_post action. It works as expected in my local dev environment, but doesn't work reliably on a hosted server. (By unreliably I mean it sometimes work, but without ...
0
votes
0
answers
12
views
Save log for imports in WordPress database - options-table, custom post type or other place?
I have a couple of custom imports, where I would like to save some log-information in the database, after they've completed, such as:
How many lines was imported.
DateTime for when it ran.
URL that ...
1
vote
0
answers
29
views
How could an event previously scheduled with wp_schedule_event later become unscheduled?
I have an event that runs every minute according to a custom schedule. The event is a function run through add_action() and scheduled using wp_schedule_event(). On this install of WordPress, ...
0
votes
0
answers
18
views
Set up a WP Cron scheduled event to update calculated ACF field
I have 3 ACF fields set up on a custom post type:
Number Value A - automatically updated every minute
Number Value B - automatically updated every minute (at the same time as Value A)
Number Value C - ...
1
vote
1
answer
25
views
Does using WP-cron make the site slower for the user?
Forgive my "beginnerness" in this matter but I have 2 options to trigger a heavy task (massive update on users' properties to solve an issue between 2 plugins that weren't meant to cooperate)...
0
votes
1
answer
142
views
Time limit on long cron job?
I'm working on a membership system which is going to process renewal payments.
If I use set_time_limit(0) inside the wp_schedule_event (cron) function, is that enough to ensure that it has the time it ...
0
votes
0
answers
33
views
WP Cron Working, but Function Not Working
I have a plugin I built for events. I set up the plugin with WP Cron to run a function. The function checks the events posts to see if it's recurring then if the start date has passed it updates the ...
0
votes
1
answer
133
views
Wordpress cron hooks - same callback for completely different action?
I am trying to better understand how Wordpress deals with cron jobs so that I can better figure out how to create some custom jobs that send emails based on single occurrence events, like lesson ...
0
votes
0
answers
26
views
Solution for processing lots of data with CRON/API, dealing with memory/timeout issues
Using a custom CRON job set up in my Wordpress site I am connecting to an external API to refresh some data. The API only allows for a certain amount of records to be read at a time so I have to "...
0
votes
1
answer
23
views
Will I get an error if I try unscheduling a WP Cron scheduled task that wasn't scheduled?
So, I'm developing a plugin, I wanted to know if I call
$timestamp = wp_next_scheduled( 'scheduled_hook' );
wp_unschedule_event( $timestamp, 'scheduled_hook' );
Without checking if it's scheduling at ...
0
votes
1
answer
27
views
Looking for a better way to initiate cron job
Is there any other good way to initiate an hourly cron job other than using register_activation_hook within a plugin?
As looks like it will not be useful for websites that have already installed and ...
0
votes
0
answers
22
views
wp_schedule_event is registered but scheduled function isn't running
I'm trying to run run_providers daily with wp_schedule_event, but it isn't working. if I add add_action( 'wp', 'run_cdc_providers' ), run_providers works -- so it doesn't work on schedule.
I tested ...
1
vote
0
answers
79
views
export a csv file from the database with a cronjob
I'm using an event plugin, which doesn't have a user-friendly function for showing a list of bookings. That's why I wrote a php+js script myself to display that data in a nice way.
But to use my own ...
0
votes
1
answer
34
views
Why is apache access log not showing GET requests related to cron job?
In my wp-config.php, I have
define('DISABLE_WP_CRON', true);
I am on a Mac (Catalina), and if I run from the terminal crontab - l I see
* * * * * wget -q -O - 'https://mysiite.com/wp-cron.php?...
0
votes
1
answer
22
views
Wp Cron and Wordpress Updates
If I disable wp-cron from config, will automatic updates still work?
In one of my sites I need to disable wp-cron as its causing high CPU usage but of course I wouldn't want to disable automatic ...
0
votes
1
answer
42
views
Strange cron job behavior and how to solve it?
My site health said cron evens has missed schedule, so I installed “Wp control” plugin to check the cron evens.
Normally “next run” will show the future time, but in my case it shows a time in the ...
0
votes
0
answers
80
views
Wordpress cron not getting executed when called by external service (but ok from browser)
I'm trying to set up an external cron service to run cron in my WP site.
I have disabled WP's own cron using define('DISABLE_WP_CRON', true); in wp-config.php.
As for the URL to call from the external ...
0
votes
1
answer
33
views
Cron: Update four post at Hour
I have function that update post content automatically based from custom field like this:
function update_content(){
$mycustomfield = get_post_meta( get_the_ID(), 'customfield', true);
$...
0
votes
0
answers
49
views
Running server cron job to update WP custom posts
I am using the WP Import plugin to import custom posts with custom taxonomies. All working properly. I see someone discussed a similar issue a few years ago but I couldn't find a solution to it. I am ...
0
votes
1
answer
54
views
Bulk updating a group of WordPress Pages every 10 minutes
I need to bulk update 86 specific WordPress Pages every 10 minutes, with the term updating I mean the same thing as clicking the Blue Update Button on each page, and having them all update at the same ...
1
vote
1
answer
58
views
Code run fast on a cronjob but slow with a do_action or ajax call
I am creating several posts from a csv, when I execute the code using a cronjob the operation lasts about 7 minutes, but if I use the code directly in a template, or make a call to do_action or ...
0
votes
1
answer
128
views
Activate Plugin Automatically After Set Time
please how do I activate a plugin after a set period of time automatically. For example, let's say I want to activate Jetpack automatically after 3 weeks. Thanks
0
votes
1
answer
132
views
Call to undefined function wp_create_category()
I’m sorry, I speak a little English.
My custom theme:
~/wp-content/themes/mycustomtheme/functions.php
function mct_task() {
include( get_template_directory() . '/inc/cron.php' );
}
add_action( '...
0
votes
1
answer
41
views
WP-Cron called by separate server
I have a Dev server and a Production server for my website. Two separate servers, with their own IPs.
WP-cron does not ever spawn on the Production server - if I search the Apache access / request ...
0
votes
0
answers
50
views
Certain functions are not available when executed with wp_schedule_event
I'm publishing post using an schedule event. The publish function uploads an image using media_sideload_image and creates a post.
The issue is when this event triggers, it fails with the error ...
0
votes
1
answer
126
views
Run function after a post has finished saving - callback function perhaps?
Upon saving a new post (of a certain post type), a given operation has to run. The problem is that the operation is calling an external (slow) API, which means that the (not logget in) end-user might ...
0
votes
0
answers
49
views
Adding $args to wp_schedule_event() causes hook to add infinitely to WP Cron
I'm working on calling my function from server cron instead of using WP Cron. The problem I occured is simple. When I add $args to wp_schedule_event() method, and check for the successfull addition in ...
0
votes
1
answer
39
views
WP_cron keeps going back to the past
When I execute this command wp cron event list, this is the output:
+-------------------------------------------------------------------+---------------------+----------------------+---------------+
| ...
0
votes
0
answers
54
views
Compare time value in WP_User_Query for sending emails
I am trying to setup a custom plugin that will compare the time (last activity of a user) and send emails to them. I am using the below WP_User_Query and a cron job
function reminder_email() {
// Get ...
0
votes
0
answers
61
views
wp-cron and woocommerce subscriptions killing performance
I wonder if replacing wp-cron by steeing my server cron tasks is going to work.
I have disabled cron on a test site i am trying to optimize and the performance increased a lot.
Thanks for any ...
0
votes
2
answers
85
views
Large Wordpress CRON job
I'm programming the integration with external API (real estate). I have one CRON job which is planned for at 1 o'clock am. It's running very well because I'm using server CRON initialize instead WP ...
0
votes
1
answer
37
views
reminder wp_schedule_event
Hi I use this plugin for create events https://wordpress.org/plugins/modern-events-calendar-lite/ and this for send notification on my android app. https://github.com/dream-space/wp-fcm
I make ...
0
votes
1
answer
51
views
Manually running cron from the server
I have a staging server begind basic auth and I'd like to run system cron instead of WordPress 'cron'.
I've placed the define('DISABLE_WP_CRON', true); in my wp-config.php, and first I've added
*/5 * *...
2
votes
0
answers
556
views
Block only external access to wp-cron.php on OpenLiteSpeed
I use OpenLitespeed server with multiple Wordpress installation and want to restrict external access to some files, only allowing server itself to access them (for example to call cron), so:
What I ...
1
vote
0
answers
152
views
Trash / Draft a WordPress custom post after custom date field expires
I have seen some examples of people asking similar to this but no real solution. Hopefully someone maybe able to point me in the right direction
I have a Custom Post Type set up called ...
0
votes
0
answers
15
views
How to Run Plugin on Server Without Web Browser
I have a function that requests product data from Amazon (get_product_data()) and would like to run this on my live site either on command or at regular intervals. To save the data into the database I ...
5
votes
1
answer
363
views
Do WordPress' cron's clean up expired transients?
WordPress has a cron named "delete_expired_transients" as seen in the image below.
In this way, does it clean expired transients daily?
Or is it just giving us action?
Should we clean it ...
0
votes
0
answers
228
views
Setting up a cron job to auto update a custom field
I need help to setup a cron job to update a custom field (created with Advanced Custom Field) every 8 hours.
This is the function to define the custom time schedule:
function cron_schedule_eight_hours(...