• Resolved Joe Hall

    (@redbmedia)


    Hello all,
    As some of you may know. I am currently working on my first plugin! I am having a great time doing it, however, I keep getting errors when I activate. The errors are found in the admin section of WordPress. All of the errors follow the format below. My plugin modifies the header on the blog to include some custom JavaScript. It appears that the plugin is also trying to modify the headers in the admin section. Can anyone tell me how to get it not to attempt to modify admin headers?

    My warnings and code are below.

    WARNINGS:

    Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/laughingduck/wp-content/plugins/MyPlugin/MyPlugin.php:52) in /home/user/public_html/laughingduck/wp-login.php on line 202
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/laughingduck/wp-content/plugins/MyPlugin/MyPlugin.php:52) in /home/user/public_html/laughingduck/wp-login.php on line 214
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/laughingduck/wp-content/plugins/MyPlugin/MyPlugin.php:52) in /home/user/public_html/laughingduck/wp-includes/pluggable.php on line 557
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/laughingduck/wp-content/plugins/MyPlugin/MyPlugin.php:52) in /home/user/public_html/laughingduck/wp-includes/pluggable.php on line 694

    CODE:

    <php?
    
    function addHeaderCode() {
        ?>
    
    <script type="text/javascript" src="<?php bloginfo('url'); ?>/wp-content/plugins/MyPlugin/js/MyPluginJS.js"></script>
    
       <?php
    }
    
    add_action('wp_head', 'addHeaderCode');
    
    ?>

    PS: above code is complete with out plugin header info.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘New Plugin Screws Up Header – Please Help.’ is closed to new replies.