tags:

views:

218

answers:

1

What is the best way to call the wordpress API from a Zend Powered page outside of the wordpress installation?

I currently have this code on a php page outside of wordpress.

define('WP_USE_THEMES', false);
require('/wordpress/wp-blog-header.php');

I try and run the page and get this error:

Fatal error: Call to undefined method stdClass::set_prefix() in /wordpress/wp-settings.php on line 268

I have been trying to troubleshoot the problem using some of the suggestions on this page. But to no avail. What's the best way to load the wordpress API so I can call it on php pages outside of wordpress?

A: 

I'm getting exactly the same issue as you are above. I don't think the problem is specifically that you are trying to load from outside WordPress. It is because the above code is being called from inside a function, outside of WordPress.

I am not using the Zend framework, but when I try to access WordPress using the code above, it's no problem. When I try to load it from the context of my CMS (within a function) I get the same error as above.

Sorry I can't help, but I thought my observation might help someone find a solution.

Rich
I tried taking the call out of a function. Still same error. Thanks for the advice though!!!!
JR