getting error message “headers already sent” in wo

2019-08-03 23:40发布

This is the error message I'm getting. I built my own theme and it pulls in a bunch of files with functions.php

Warning: Cannot modify header information - headers already sent by (output started at /home3/keganqui/public_html/dev/wp-content/themes/optimus/functions.php:5) in /home3/keganqui/public_html/dev/wp-includes/pluggable.php on line 866

new functions.php file, but the same error message occurs:

<?php require(TEMPLATEPATH . '/inc/misc.php'); ?>
<?php require(TEMPLATEPATH . '/inc/widgets.php'); ?>
<?php require(TEMPLATEPATH . '/inc/homepage.php'); ?>
<?php
/* Include back-end */
if(is_admin()){ include TEMPLATEPATH.'/panel/panel.php'; }

/* Include front-end */
if(!is_admin()){ include TEMPLATEPATH.'/panel/panel-front.php'; }
?>

标签: php wordpress
2条回答
淡お忘
2楼-- · 2019-08-04 00:21

Chances are you have white space before your <?php tag. But as toscho said, please update your question with the first lines of functions.php

UPDATE

your functions file should be like this:

<?php 
require(TEMPLATEPATH . '/inc/misc.php');
require(TEMPLATEPATH . '/inc/widgets.php');
require(TEMPLATEPATH . '/inc/homepage.php'); 

/* Include back-end */
if(is_admin()){ include TEMPLATEPATH.'/panel/panel.php'; }

/* Include front-end */
if(!is_admin()){ include TEMPLATEPATH.'/panel/panel-front.php'; }
?>
查看更多
叼着烟拽天下
3楼-- · 2019-08-04 00:27

You must have only once your session_start() right after your opening php tag . If you have a main page and include in files with functions e.t.c dont put again the session_start() in those files. Just have one session_start at your main php file

查看更多
登录 后发表回答