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');
  • How do you call your plugin... the function that contains your register_theme_directory(). You probably need to find a different hook. – user42826 Dec 17 '13 at 21:58
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
    The plugins_loaded hook is too early for this case, actually. He should wait until admin_init, at least. – Otto Dec 18 '13 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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