Articles of wp cron

Display a random tag but using cron to control frequency of change

Background – I have created a shortcode in functions.php which adds a single random tag with it’s link and description to a widget in my sidebar. This is my existing code… function skips_get_random_tags() { $args = array(‘exclude’ => ”); $alltags = get_tags( $args ); shuffle($alltags); $count=0; if ($alltags) { foreach($alltags as $tag) { $count++; return […]

How to make a cronjob type plugin

Hi i am new on wordpress and has been given a task to make such a script that will fetch posts by categories and shoot email to subscribers. The table structure for subscriber is below Subscriber Id – primary key Subscriber email – varchar Category Id – int Now the task is to fetch post […]

what effective ways are there to debug cron

Right now about 25% of the entries in my access log (which do not show resource like css, images, etc) are requests to wp-cron.php. I assume there is some process event that got “stuck” and keep firing but how can I find which one? It is a live server there the amount of hacking I […]

WP-Cron function not firing

I am trying to get a simple php function working with cron (based on a tutorial). I have the following: <?php if (!wp_next_scheduled(‘please_just_work’)) { wp_schedule_event( time(), ‘daily’, ‘please_just_work’ ); } add_action ( ‘please_just_work’, ‘my_task_function’ ); function my_task_function() { $test_score = 30; update_field(‘score’, $test_score ); } ?> I can see the cron job in the Crontrol […]

my wp schedule event is not working

function wp_cron_define(){ add_filter(‘cron_schedules’, function($schedules){ $schedules[‘mine’] = array( ‘interval’ => 30, ‘display’ => ‘once in a week’ ); //for defining the schedule timing if(!wp_next_scheduled(‘sen_hook’)) { wp_schedule_event( time(),’mine’,’sen_hook’); } } add_action(‘sen_hook’,’hello’); function hello(){ echo ‘hello’; } add_action(‘wp’,’wp_cron_define’); now whenever the user visit the page they should see the hello but i am not seeing any thing so […]

No result update a custom field using wp_schedule_event

I recently developed a news blog. My client asked for a facebook share count of an article. I am able to get the share count using facebook api, However, according to the information I found from various questions from here and there, facebook limits the number of API calls. So, i have decided to pull […]

Cancel/Stop a currently ongoing scheduled cron event?

If I scheduled a CPU-intensive job via a cron scheduled event, how do I go about stopping it or cancelling the job while it is currently running?

How to prevent the scheduling of the same event on the same day

I have an system right now where the user can setup to send out emails on a schedule. However, my clients want the ability to only allow 1 scheduled email to go out once a day. If they attempt to schedule another email to go out after it has already gone out that day they […]

WordPress cron is running with previously set time intervals and not the updated one

For testing purposes I keep short time intervals for cron and when the functionality is working fine, I change it to the required time interval. Whenever I change the time intervals for ex: from ‘three_days’ to ‘five_minutes’ or from ‘five_minutes’ to ‘fifteen_minutes’, the cron is running with earlier frequency and not the updated one. I’m […]

Reset/delete post views meta/custom field after X hours or minutes or seconds

There’s lots of snippets and plugins that will count post views but I’m trying to find a way a way to reset the number of views back to zero after X hours(or minutes or seconds or whatevaaaa). I’m assuming i’d need incorporate this <?php delete_post_meta($post_id, $meta_key, $meta_value); ?> Here is the snippet I’m using… function […]