This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Cron not working properly

#24447
Ernest MarcinkoErnest Marcinko
Keymaster

I honestly don’t know, programatically everything seems to be okay.

Well, I found a custom code from a different ticket, where the user was requesting a manual CRON job, that he wanted to execute on his server, via triggering a URL.

I recommended this custom code to the functions.php file in his theme directory:

add_action( 'init', 'asp_cron_trigger' );
function asp_cron_trigger() {
  if( isset( $_GET['asp_cron_trigger'] ) ) {
    $o = new WD_ASP_IndexTable_Action();
    $o->extend();
    $asp_cron_data = get_option('asp_it_cron');
    if ( isset($asp_cron_data['result']['postsIndexedNow']) ) {
      print 'Ajax Search Pro Index Table Extended<br />';
      print 'Indexed: '.$asp_cron_data['result']['postsIndexedNow'];
      print ' | Keywords found: ' . $asp_cron_data['result']['keywordsFound'];
    }
    die();
  }
}

Then basically visiting this link:
yoursite.com/?asp_cron_trigger
..would trigger an index table extend event. He then put this to his cron table on the server side via SSH and curl I think. I’m not sure if this still works, but since something is cleaning up the wordpress cron job, this might be a possible alternative.