• Hello,

    I have serious problem. When I want to load function wp_handle_upload in my theme functions.php file. It shows me error: Fatal error: Call to undefined function wp_handle_upload() in C:\xampp\htdocs\thisblog\wp-content\themes\geektheme\functions.php on line 150

    Why I get it in my theme ? Maybe I need to add any global word ?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter andriuss

    (@andriuss)

    Can anybody tell me?

    Hi,

    It’s because the function is meant to be used on a plugin, not a theme.

    Try including those files before the call:

    include_once($_SERVER['DOCUMENT_ROOT'].'wp-admin/includes/media.php');
    include_once($_SERVER['DOCUMENT_ROOT'].'wp-admin/includes/file.php');
    include_once($_SERVER['DOCUMENT_ROOT'].'wp-admin/includes/image.php');
    _

    (@viniciusmassuchetto)

    Better this way:

    include_once ABSPATH . 'wp-admin/includes/media.php';
    include_once ABSPATH . 'wp-admin/includes/file.php';
    include_once ABSPATH . 'wp-admin/includes/image.php';
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_handle_upload in functions.php file’ is closed to new replies.