Forums

How do I use WP functions outside a web context? (2 posts)

  1. kokaku
    Member
    Posted 3 years ago #

    I am trying to use WP login/logout/authentication functions in a PHP script that is not running in a web context. The script is running on the command-line through a testing tool called PHPSpec.

    PHPSpec ran my script fine before I added a dependency on the WP functions. I can call those functions within a web context without problem (using require_once "wp-config.php") but it fails on the command-line with...

    Fatal error: Call to a member function set_prefix() on a non-object in /var/www/hhy/wp-settings.php on line 211

    Any ideas?

  2. photo312
    Member
    Posted 2 years ago #

    Its funny - I am having the same problem. The set_prefix is not working because the database object is not being set. In other words - the database is not being connected for some reason....

    anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic