Can’t use wordpress functions in custom php file

I am trying to write a custom php function for WordPress that a custom Java program can access, the problem is anytime I try to use a WP function such as wp_hash_password it fails and returns a filenotfoundException.

The custom php file is sitting on the root directory of my wordpress installation and I have put

Read More
require(ABSPATH. 'wp-includes/pluggable.php');

at the top of the file so it would know where to find the function.

Am I missing something? Because even with the above file included, it is still failing.

IF I take out all wordpress functions it ‘works’.

Related posts

Leave a Reply

2 comments

  1. Try something like this in addition for easier inclusion:

    preg_match('/^(.+)wp-content/.*/', dirname(__FILE__), $path);
    include($path[1] . 'wp-load.php');