2

I'm trying to use get_home_path() in my plugin, however, I get a call to undefined function fatal error (running Wordpress 3.8).

I believe this would imply that my plugin is being loaded before wp-admin/includes/file.php where get_home_path() is located, right?

Is it just me, or is that a little odd? How can I make file.php load first so I can access this function?

The line of code that causes this issue (within my plugin) is:

register_theme_directory(get_home_path().'/material/views');
1
  • How do you call your plugin... the function that contains your register_theme_directory(). You probably need to find a different hook.
    – user42826
    Commented Dec 17, 2013 at 21:58

1 Answer 1

1

to make sure everything required is loaded before plugins loads, use plugins_loaded hook and initialize your plugins its callback funtion. for example:

add_action('plugins_loaded',function(){
  // initialize your plugins here.
});
1
  • 1
    The plugins_loaded hook is too early for this case, actually. He should wait until admin_init, at least.
    – Otto
    Commented Dec 18, 2013 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.