I get this error while trying to load wordpress in a smarty template. But when I visit wordpress I dont get that error any where.

the code I use to load wordpress is :

{php}include $_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-load.php';

The Error : Fatal error: Call to a member function add_rewrite_tag() on a non-object in /wp-includes/taxonomy.php on line 333

2 Answers 2


Read Don’t include wp-load, please. Then look at this answer to understand the difference to the load of wp-blog-header.php.

  • I changed wp-load.php to wp-blog-header.php and still getting the same error.
    – alhoseany
    Commented Apr 7, 2012 at 23:06

Found the solution. just add this code before including wp-blog-header.php.

global $wp_rewrite;

source: https://github.com/kayue/WordpressBundle/issues/2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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