Cron Job not working when require_once WordPress file “wp-header.php”

I need a script to be run every minute by a cron job. The script needs to include 2 files including 1 wordpress file, “wp-blog-header.php”, and 1 non-wordpress file, my custom functions.php:

require_once (__DIR__ . '/../../wp-blog-header.php');
require_once (__DIR__ . '/functions.php');

The problem is that “requiring_once” “wp-blog-header.php” makes the cron not to run. I know because if I take it off and only include my custom functions.php, the cron job works as it is supposed to.

Read More
require_once (__DIR__ . '/functions.php');

I need to include “wp-blog-header.php” because I need to use wordpress functions. Is it because “wp-blog-header.php” might be also including other files?

Any idea how can I include this wordpress file?

My cron comand is:

php -q /home/enkaizene/public_html/soporte/wp-content/scripts/index.php

Please help ! Thank you!

Related posts