Skip to content

WordPress – PHP Fatal error: Call to undefined function get_bloginfo()

I’m integrating an external script with my wordpress theme and I’m getting this error in one of my files:

PHP Fatal error: Call to undefined function get_bloginfo()

this script is located in

themes/mytheme/myscript

And all files are included as following:

include(WP_CONTENT_DIR."/themes/mytheme/myscript/myfile.php");

how can I fix it?

Advertisement

Answer

you must include wp-blog-header.php in your main php like this

require WP_DIR.'/wp-blog-header.php';

being WP_DIR the main wp directory

User contributions licensed under: CC BY-SA
4 People found this is helpful