Sometimes plugins don’t get on with each other. If you try running the iPassion-Tell-a-Friend plugin alongside All-in-one-SEO Pack, then you may run into problems. I was recently asked to get these two plugins playing together nicely by a client who was getting a “Headers Already Sent” error message whenever data was submitted through the Tell-a-Friend form.
The problem is that the Tell-a-Friend plugin redirects users to a success page using header("Location: $successPage");. This instruction needs to be sent to the browser before any other code, but by the time Tell-a-Friend sent its redirect instruction All-in-one-SEO Pack had already output some meta tags, hence the error.
Getting Tell-a-Friend to go first, redirecting the user to the success page before All-in-one-SEO does its thing, fixed the conflict.
Both plugins hook into WordPress’s wp_head action using the add_action function. Out of the box, Tell-a-Friend hooks in like this: add_action ('wp_head', 'addTellaFriendSender');
This line of code tells WordPress that when it gets to the wp_head hook, it should call the addTellaFriendSender() function, which is the function that does most of the Tell-a-Friend plugin’s work.
Changing this line to the following resolved the clash between Tell-a-Friend and All-in-one-SEO: add_action ('wp_head', 'addTellaFriendSender', '1');
Every function that’s hooked into wp_head (or any other hook) has a priority between 1 and 15 (the lower the number, the higher the priority). The add_action function’s third parameter, $priority, sets this priority. The parameter is optional, and defaults to 10, so the out of the box add_action call hooks addTellaFriendSender into wp_head with a priority of 10, which is the same as All-in-one-SEO Pack’s priority.
The modified add_action call hooks addTellaFriendSender into wp_head with a priority of 1, moving it to the front of the queue and making sure that its redirection instruction comes before anything else that might cause a conflict.