Support » Plugin: WooCommerce » Uncaught Error: Call to undefined function get_home_path() after update to 3.5.1

  • Resolved gore.m

    (@gorem)


    Hello,
    after update to Woo 3.5.1 Im getting Uncaught Error: Call to undefined function get_home_path() on checkout page by my email attachments function $file_path = get_home_path() . '/doc/'; I didnt have any problem until update.

    Do you have any idea / are there any changes (in emails) or anything that can cause Uncaught Error: Call to undefined function get_home_path()?

    Thanks you

    Im on WP 4.9.8

Viewing 7 replies - 1 through 7 (of 7 total)
  • Full Error Log:

    [12-Nov-2018 18:11:05 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_home_path() in /hosting/www/example.com/www/wp-content/themes/test/functions.php:950
    Stack trace:
    #0 /hosting/www/example.com/www/wp-includes/class-wp-hook.php(286): custom_email_attachments(Array, 'customer_on_hol...', Object(WC_Order))
    #1 /hosting/www/example.com/www/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array)
    #2 /hosting/www/example.com/www/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(399): apply_filters('woocommerce_ema...', Array, 'customer_on_hol...', Object(WC_Order))
    #3 /hosting/www/example.com/www/wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-on-hold-order.php(92): WC_Email->get_attachments()
    #4 /hosting/www/example.com/www/wp-includes/class-wp-hook.php(286): WC_Email_Customer_On_Hold_Order->trigger(1071, Object(WC_Order))
    #5 /hosting/www/example.com/www/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL in /hosting/www/example.com/www/wp-content/themes/test/functions.php on line 950

    Don’t use get_home_path() in your theme. It’s only loaded on the admin pages.

    Im using it to attach pdf to emails, so it is not front end… is it wrong too?
    If yes, is there an get_home_path() equivalent?
    Thanks you

    What filter are you using?

    woocommerce_email_attachments

    You could use WP_CONTENT_DIR or ABSPATH instead.

    Ive tried wp_content_dir() with the same result Fatal error: Uncaught Error: Call to undefined function wp_content_dir() in C:\wamp64\www\test\wp-content\themes\test\functions.php:950

    ABSPATH is working .-) Thanks you

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Uncaught Error: Call to undefined function get_home_path() after update to 3.5.1’ is closed to new replies.