Facebook PHP SDK and WordPress Plugin
-
I’m writing a plugin that uses the Facebook PHP SDK. I am using the latest version which i downloaded from github.
I’m trying to include it in my plugin, but when i run the function that grabs my public feed I am getting “header” errors.
Here are the errors I am getting:
Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at {path_to}/wp-admin/includes/template.php:1698) in {path_to}/wp-content/plugins/{plugin_name}/facebook-php-sdk-master/src/facebook.php on line 48
And very similar error for “Cannot send session cache limiter”.
I’ve done some searches in google and bing and turned up something about using ob_start() and ob_end_flush(). I’ve tried the ob_start at the beginning of my plugin file and ob_end_flush at the end of the file. It doesn’t seem to do anything. I’ve tried putting ob_start in multiple places (inside the primary function, outside of the primary function, inside of the facebook.php, inside the base_facebook.php, etc.) None of those options worked really.
I’ve also read that there is a different flavor of the Facebook SDK that Facebook uses in the official Facebook plugin.
Do i have to install the Facebook plugin and use its SDK and then require my users to install the Facebook plugin in order to use my plugin. God i hope not. I don’t want to have additional resources required. I would prefer to have the plugin self contained.
If someone can offer some guidance that would be awesome!
*UPDATE* – I also tried setting my servers /tmp folder to get the errors to disappear, but no luck. I read that that would work.
Lastly, I also have WP DEBUG in my wp config file enable so that i can see any errors that pop-up.
- The topic ‘Facebook PHP SDK and WordPress Plugin’ is closed to new replies.