Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

0
votes
2answers
18 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
17 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
29 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
14 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
25 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
48 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
31 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
17 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
25 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
20 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
28 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
15 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
13 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
117 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
65 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
24 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
121 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
34 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
46 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
35 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
20 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
49 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
157 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
53 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
125 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
77 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
94 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 ...
0
votes
2answers
50 views

How to create and run cronjob in WP without using the plugin?

I have a problem I'm wondering, need someone to help. I am doing a function that sends email to followers weekly and monthly. Currently, I have written a function to use, but one thing is I do not ...
0
votes
0answers
137 views

Cron job script - loading wordpress system fails

I want to run a cron job that fetches data from an api and stores it in a database table. I don't use "wp-cron". I load a script in a folder inside the theme. But I need to load the wordpress system ...
0
votes
2answers
20 views

Plugin scheduled event not working

I have created this interval in my functions.php: function minute_interval( $schedules ) { $schedules['minute'] = array( 'interval' => 60, 'display' => __('Every minute') ); ...
0
votes
1answer
37 views

Switch from wp-cron to a server cron job

I'm creating a wordpress plugin that trades cryptocurrencies. It's a bot and I need to check the currency values every 10 seconds. In order to do that I need to run a PHP script through a cron-job. I'...
0
votes
0answers
41 views

Cron on plugin in multiple WP installations; common plugins directory

I have multiple WorpPress installations on a single domain (I do not want to use a network install), with a common /wp-content/ directory defined as follows in each config.php file: define('...
0
votes
0answers
15 views

Remove Role as part of a Schedule Event not Running

I have an odd situation. I made a scheduled event that when run will check a custom field and compare to the current date, if the date is expired, the user is removed from the matching role. The ...
0
votes
0answers
40 views

Will disabling wp-cron.php stop cron from firing when someone manually visits the URL, MYSITE.com/wp-cron.php?

I'm trying to prevent robots from spamming the MYSITE.com/wp-cron.php URL and causing cron to fire, inturn causing spikes in resource usage. If I disable the default Wordpress Cron by define('...
1
vote
1answer
106 views

System Cron job not firing

I am new with WordPress development and using cron job for first time. I am having issue with cron job which is not firing. Here are all steps i have taken to achieve this. I have put this line in my ...
1
vote
1answer
293 views

Why?: hundreds of empty files named wp-cron.php?doing_wp_cron.<digit>

In the home directory of the nginx user I have hundreds of empty files named wp-cron.php?doing_wp_cron. So my questions are why...? can I delete them...? . and how do I stop then regenerating? ...
0
votes
0answers
27 views

Cron job emails blank

Was just wondering if anyone could throw some advice my way? I have a site setup on SiteGround and have turned off the internal WordPress cron as this was hitting the server resources fairly hard. I ...
0
votes
1answer
954 views

How to get woocommerce cart content without an action?

With every photo upload, I create a woocommerce product and you might get the idea that at some point I will have lots of unused products. I save product id and image upload links to a text file. ...
0
votes
0answers
29 views

set $GLOBALS in cron script

For the sake of clarity, I'll skim over some of the details; I have a (real) cron script which runs every 30 seconds, which requires wp-load.php and then loops over all woocommerce products and ...
0
votes
1answer
345 views

External cron job firing too many times

Wordpress' cron jobs seemed to cause some issues on our server, so I added this to the bottom of our wp-config.php: define('DISABLE_WP_CRON', 'true'); And added this using 'crontab -e': */15 * * * *...
0
votes
2answers
251 views

Running wp-cron from CLI

Not sure if my assumption is correct regarding running wp-cron from CLI would be slightly faster than calling it via wget or curl, so either way I'm trying this: /usr/bin/php /var/www/mywebsite.com/...
0
votes
1answer
313 views

WP Cron job timeout issues

I have to run a php function for around 10 minutes. Now I am sheduling the job as a wp-cron-job. But it is getting timed out after 30seconds which is the maximum execution time for php. How to get rid ...
0
votes
0answers
66 views

how to make a cronjob run, when user needs to be logged in

My multisite wordpress site works the way, that if someone is not logged in, they will be redirected to wp-login.php. Unfortunately i have a cronjob, that can not run, because it is also redirected, ...
1
vote
0answers
256 views

Wordpress Cron Job Not working

can you help me with this please, what am I missing? This one works: if ( ! wp_next_scheduled( 'my_hook_2' ) ) { wp_schedule_event( time(), 'hourly', 'my_hook_2' ); } add_action( 'my_hook_2', '...
1
vote
0answers
263 views

running wp-cron.php using php not wget

I operate some servers which have a few WordPress websites on them. I was having some issues with the cron jobs being triggered too often or not enough so I replaced all of them with crontab entries, ...
0
votes
1answer
97 views

Can I run a slow action in a seperate thread?

I have a really slow-running action (30-45 seconds) that loops over each user in my DB and syncs the data with some off-site database. I want this to happen once or twice daily, so I have a WP-Cron ...
3
votes
2answers
125 views

What would be a PHP command to erase all posts from category X from the last month?

I wish to run a cron job that would permanently erase all the posts belonging to some category from the past X days (say, week). This is probably very basic, but I would appreciate some pointers. ...
0
votes
1answer
40 views

Avoiding “Missed Schedule” errors when inserting future posts

I'm inserting future posts as you'd expect using a post_status of future and a future post_date and post_date_gmt. The dates look fine in WordPress, but these posts appear with the "Missed Schedule" ...
1
vote
2answers
42 views

Set a menu item to display during certain times

I have a "utility navigation" on the top of my website that currently has two links - one to our blog and the other to the weekly newsletter. We also do a radio show everyday at 5pm, as well as a ...