Questions tagged [cron]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
7 views

Cron job for creating posts not excecuting properly

I've written a PHP script to create custom posts programmatically from Google Calendar events, and an action hook that purges all existing events and repopulates it with current ones. This works fine ...
0
votes
0answers
11 views

Flush rewrite rules with scheduled event (cron)

I'm trying to flush rewrite rule with a wp_schedule_event function el_custom_cron_schedule( $schedules ) { $schedules['el_every_5mn'] = array( 'interval' => 5*60, 'display' =&...
1
vote
0answers
7 views

Programmatically save one/any post

I am using WP All import in order to import listings in a website. Everything works well except displaying all listings in a map. If i edit any listing, and then click Update (without making any ...
0
votes
0answers
18 views

Use wp_remote_get() with a private or password protected page?

Is there any way to use the wp_remote_get() function to access a WordPress page that is either set to Private -OR- password protected (using the native password option in the post visibility settings)?...
0
votes
1answer
13 views

How to Set a Condition via Page Template Name in WP Cron Job?

I have created a Cron Job Function. But, I can't set a condition for Cron Job. Basically I want Cron Job need to work if the Template File Name is page-delete.php So, How can I set Condition using ...
0
votes
0answers
16 views

wp_schedule_event not running or visible when viewing _get_cron_array()

I have seen various similar questions with answers, but still unable to get this working. I just have a simple email which is meant to be sent out weekly with a list of new quotes. The email ...
0
votes
0answers
27 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
32 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
100 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
1answer
41 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
34 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
38 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
36 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
10 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
72 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
26 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
25 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
79 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
23 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
122 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
57 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
18 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: // ...
1
vote
0answers
109 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
540 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
148 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
115 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
17 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
3answers
55 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
76 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
24 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 ...
1
vote
1answer
481 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
418 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
109 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
68 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
51 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
73 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
289 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
266 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
1k 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
1k 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
65 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
80 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
197 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
242 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
125 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
3k 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
53 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
623 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
2 3 4 5 6