I am stuck with this error when trying to login to the admin panel. I can't get my head around it.
Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/public_html/wordpress/wp-config.php:1) in /home/xxxxxx/public_html/wordpress/wp-includes/pluggable.php on line 881
pluggable.php 881:
function wp_redirect($location, $status = 302) {
global $is_IIS;
$location = apply_filters('wp_redirect', $location, $status);
$status = apply_filters('wp_redirect_status', $status, $location);
if ( !$location ) // allows the wp_redirect filter to cancel a redirect
return false;
$location = wp_sanitize_redirect($location);
if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
status_header($status); // This causes problems on IIS and some FastCGI setups
header("Location: $location", true, $status);
}
endif;
I am using the latest version wordpress 3.4.2. My site seems to be working just fine but the error prevents me getting in to the login page which means I can't admin at all or uninstall the plugin (dbc backup 2) which seems to have triggered this problem. I have checked the wp.config file hunderds of times with HTML-kit tools and there is no visible whitespace at the begining nor at the end of the file. I have:
- Checked the whitespaces from wp-config file with HTML-Kit tools
- Downloaded and inserted new fresh wp-config file
- Disabled the plugins directory by renaming it
...and the error still remains
The only thing left for me to try is this code someone posted on wordpress forums claiming he had solved this problem by inserting the following code to the wp-config.php file:
<?
//dont use header function in wordpress-wp_signup.php
global $domain;
global $path;
//change urlnew variable as per requirment
$urlnew = "http://".$domain.$path."/wp-admin/admin.php;
echo "<script>";
echo "location = '$urlnew';";
echo "</script>";
echo $urlnew;
?>
I am reluctant to add code as I am not familiar with html or php and I do not exactly understand how this code functions nor have detailed instructions where to place it exactly. Any better suggestions?
Themes function.php file ends like this, where should I exactly insert the code?:
// include custom widget
$temp_root = get_root_directory('include/plugin/custom-widget/custom-blog-widget.php');
include_once($temp_root . 'include/plugin/custom-widget/custom-blog-widget.php');
$temp_root = get_root_directory('include/plugin/custom-widget/custom-port-widget.php');
include_once($temp_root . 'include/plugin/custom-widget/custom-port-widget.php');
$temp_root = get_root_directory('include/plugin/custom-widget/custom-port-widget-2.php');
include_once($temp_root . 'include/plugin/custom-widget/custom-port-widget-2.php');
$temp_root = get_root_directory('include/plugin/custom-widget/popular-post-widget.php');
include_once($temp_root . 'include/plugin/custom-widget/popular-post-widget.php');
$temp_root = get_root_directory('include/plugin/custom-widget/contact-widget.php');
include_once($temp_root . 'include/plugin/custom-widget/contact-widget.php');
$temp_root = get_root_directory('include/plugin/custom-widget/flickr-widget.php');
include_once($temp_root . 'include/plugin/custom-widget/flickr-widget.php');
$temp_root = get_root_directory('include/plugin/custom-widget/twitter-widget.php');
include_once($temp_root . 'include/plugin/custom-widget/twitter-widget.php');
// get the path for the file ( to support child theme )
function get_root_directory( $path ){
if( file_exists( STYLESHEETPATH . '/' . $path ) ){
return STYLESHEETPATH . '/';
}else{
return TEMPLATEPATH . '/';
}
}
?>