Running CRON on Server with WP Function

We need to include wp-load.php in order to bootstrap WordPress in our custom PHP code. So, the modified code would look something like this…

include '/path/to/wp-load.php';
//RemoteCoins() and LoadRemoteCoins() that include wp functions like wp_remote_get()

function runthe_func() {

//some code here

}

runthe_func();

Now, if we run this file on server cron, it wouldn’t throw errors.

Oh, btw, similar questions have been asked and answered multiple times here in WPSE. For example, How to load WordPress on non WP page? .