Skip to content
Advertisement

How to start a php script from cli within wordpress

I wrote a PHP script, which was meant to be a WP-Cron-cronjob and which uses wordpress specific functions. Due to some restrictions in its runtime enviroment, I need to start this script from the command line with /usr/bin/php -q longThing.php instead of as a WP-Cron event. How can I ensure that all the wordpress core functions are callable in my script?

Advertisement

Answer

Xaedes solution works quite well:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement