I am trying to build my first plugin but am receiving the following error:
Warning: Cannot modify header information - headers already sent by (output started at
/wp-admin/includes/template.php:1642
) in/wp-includes/pluggable.php
on line 876
But here's the thing: template.php isn't 1600 lines long and pluggable doesn't have any whitespace at that point.
My plugin code is as follows:
<?php
/*
Plugin Name: Test
Plugin URI: http://www.Test.com
Description: Test
Author: Test
Version: 1.0
Author URI: http://www.Test.com
*/
function Test_admin() {
include('admin.php');
}
function Test_admin_actions() {
$icon_url = "";
add_menu_page( "Test", "Test", "switch_themes", "Test", "Test_admin", $icon_url, 58 );
}
add_action('admin_menu', 'Test_admin_actions');
?>
The admin.php file is currently empty.
The plugin adds a Test menu option in the admin page just before the Appearance option. When you click on it, you should theoretically get a white page but instead, you get the error.
So I'm pretty dumbfounded by this. I've disabled, deleted, and reinstalled my plugin to no avail.
Any ideas?
wp_redirect()
function after the admin header has been printed