How can I prove if wp cron is running my task if I have DISABLE_WP_CRON set to true

I always found that logging cron job execution to a file is very helpful. Otherwise you have no idea if it’s working right. Just have your code open a file, write a timestamp, and close. Something simple like: $logfile = $_SERVER[‘DOCUMENT_ROOT’].’/CRON.txt’; $handle = fopen($logfile , ‘a’) or die(‘Cannot open file: ‘.$logfile ); $data=”cron task called … Read more

Hook/Cron Problem

And what do you think it should do? Either you posted here only part of your code or it can’t do anything that makes sense. The only thing this function does is assigning a value to a variable. This SQL query is never executed, because you don’t execute it anywhere in your code. I guess … Read more

How do i set cron job for my WordPress site?

You can also use one of the web cron services. If you don’t have access to a web server or are on a big host that doesn’t give you access to a Control Panel then these are great. Actually, I might recommend using them in place of the cron on your server anyway since their … Read more

How to make a cronjob type plugin

Yes, you can make a plugin. Following is the way to add cron job functionality in WordPress plugin. http://codex.wordpress.org/Function_Reference/wp_schedule_event http://codex.wordpress.org/Function_Reference/wp_cron However, please note that this does not provide a real (system based) cron. It requires at least someone to visit your site, so that the functions keep on executing periodically.

WP-Cron function not firing

Looking at your function: function my_task_function() { $test_score update_field(‘score’, $test_score ); } $test_score is not defined here, it should be $test_score=”something”; Left the way you have it now will generate php warnings. Also the update_field function used in this context (in a cron) will require you to pass a third argument specifying which post/page contains … Read more

what effective ways are there to debug cron

I would create a simple plugin that spits the data out into a private admin page, you basically want to use: $cron = _get_cron_array(); $schedules = wp_get_schedules(); $tranny = get_transient(‘doing_cron’); //var_dump or loop over these There are several plugins that do this that style the output to make it easier to read and organize, also … Read more

my wp schedule event is not working

WP cron tasks execute in completely separate process from page load. Nothing from the task’s output will be ever seen by users. That’s the purpose of them, to run scheduled task without interfering with site itself. If you want to output to the page periodically you will have to build it in other way. You … Read more

No result update a custom field using wp_schedule_event

It think that your problem is the you are passing the post ID as url parameter to facebook API: $url = get_the_ID(); Also, as get_posts return an array of post objects, you could use this code: $posts = get_posts(array(‘numberposts’ => -1) ); foreach($posts as $post) { $url = get_permalink( $post->ID ); $fbcount = json_decode( file_get_contents( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)