2

I'm using get_home_path() because i need to store a file from a temporary directory to an archive folder (i'm doing this using php's copy() function).

The problem is that get_home_path() returns me an error 500 (internal server error). If i comment that function, the script works.

Any idea on why is this happening?

UPDATE as per s_ha_dum's request

here's the debug log:

[09-Jul-2015 07:36:44 UTC] PHP Fatal error: Call to undefined function get_home_path() in /www/ggp.com/wp-content/themes/ggp/functions.php on line 649

UPDATE: my code

function save_sent_mail_function() {

    [...]

        $home_path = get_home_path();

        $cvs_path = '/wp-content/uploads/cvs/'.$file_name;

        copy($file['cv'], $home_path.$cvs_path);

    [...]

}
add_action('wpcf7_mail_sent', 'save_sent_mail_function');

I found out that there's the ABSPATH constant that i can use instead of the $home_path variable

  • Interesting. That is a pretty simple function. Do you have debugging information? Do you have access to the server logs? Post your code please. – s_ha_dum Jul 9 '15 at 3:58
  • @s_ha_dum i've updated the question with the debug log – Mark Jul 9 '15 at 7:38
  • 1
    @s_ha_dum problem is that wp-admin/includes/file.php is not being included because if i copy get_home_path() in my functions.php it works correctly – Mark Jul 9 '15 at 8:01
  • So you are using a backend function on the front end. Post your code please. – s_ha_dum Jul 9 '15 at 12:33
  • 2
    @s_ha_dum and where exactly in the codex is mentioned that this is a backend function only? – Mark Jul 10 '15 at 7:18

Your Answer

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

Browse other questions tagged or ask your own question.