Looks like you have some non-php text (maybe a blank line, or a space at the start of the line) as the first line of topmenu.php. The first line must start with <?php.
I am aware of that.
But as I said – even when I copy one of the other existing plugins,
the problem is still there.
I’m sorry, I don’t understand what you mean by ‘copy one of the other plugins’. Did you mean copying a different plugin and naming it topmenu.php, or deleting topmenu.php and using a plugin with a different name?
How about pasting the first 5 lines of topmenu.php in a reply? May not help, but won’t hurt either.
<?php
/*
Plugin Name: test
Plugin URI: http://xxx.xx
Description: Test description
Version: 1.0
Author: Michael Thulin
Author URI: http://xxx.xx
*/
if (!class_exists("testclass")) {
class testclass {
function testfunction() {
function addHeaderCode() {
?>
<!-- thulin Was Here -->
<?php
}
}
}
}
if (class_exists("testclass")) {
$dl_pluginSeries = new testclass();
}
if (isset($dl_pluginSeries)) {
add_action('wp_head', array(&$dl_pluginSeries, 'addHeaderCode'), 1);
}
?>
OK, just to clarify, when you installed another plugin and it still gave you an error, did it still say topmenu.php in the error message?
I copied your code into my plugins directory and I don’t get the ‘headers sent’ error. I do get this:
Warning: call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'testclass::addHeaderCode' was given in /usr/local/apache/htdocs/wordpress/ysmagazine/wp-includes/plugin.php on line 339
addHeaderCode is nested inside testfunction so it isn’t being found.
The original error states that the headers were sent by topmenu.php. That’s were I’d look for the problem.
The key is right here in the message..
output started at /domains/www.xxx.xx/wp-content/plugins/topmenu
“Output” ie. something has been output, before the headers were sent.. (you cant output before sending headers).
Disable or fix whichever plugin that is..
was trying out some code for a plug-in tutorial.
I have tried to copy Akismet into the topmenu.php and I still get the same error therefore I thought that it actually was a problem.
But even tho I installed a plugin with following comment:
/*
Plugin Name: test
Plugin URI: http://xxx.xx
Description: Test description
Version: 1.0
Author: Michael Thulin
Author URI: http://xxx.xx
*/
(nothing more)
and the same error still appeared – why’s that?
Hi,
It is usually due to spaces, new lines, or other garbage at opening/closing PHP file <?php tag or after a closing ?> tag in wp-config.php. It can be other file too so need to check error message as it may list file name where the error occurred.
One can either upload error file from the backup or edit erroneous file. To edit the file one need to check below mentioned points:
1. Download the file mentioned in the error message.
2. Open that file in a plain text editor
3. Check that the very first characters are <?php
4. Check that the very last characters are ?>
5. Place the cursor between the ? and >
6. Now press the DELETE key on your computer and keep that key pressed for at least 15 seconds.
7. Now type > and
8. Save without pressing any other key at all.
That’s it!
Thanks,
Shane G.