Php 已在WordPress中发送标题

Php 已在WordPress中发送标题,php,wordpress,http-headers,wordpress-theming,Php,Wordpress,Http Headers,Wordpress Theming,可能重复: 所以我犯了一个奇怪的错误,我已经准备好了一些东西来挫败这个目标。成功更新WordPress主题后,您应该立即被重定向到特定位置。在那之前,我经常会发疯说: Warning: Cannot modify header information - headers already sent by (output started at /home/kyle/WordPress/WordPressDev/wp-includes/script-loader.php:789) in /home/

可能重复:

所以我犯了一个奇怪的错误,我已经准备好了一些东西来挫败这个目标。成功更新WordPress主题后,您应该立即被重定向到特定位置。在那之前,我经常会发疯说:

Warning: Cannot modify header information - headers already sent by (output started at /home/kyle/WordPress/WordPressDev/wp-includes/script-loader.php:789) in /home/kyle/WordPress/WordPressDev/wp-includes/pluggable.php on line 881
所以有人过来说,嘿,把这个放到你的functions.php中,它就会工作:

 function callback($buffer){
     return $buffer;
 }

 function add_ob_start(){
     ob_start("callback");
 }

 function flush_ob_end(){
     ob_end_flush();
 }

 add_action('wp_head', 'add_ob_start');
 add_action('wp_footer', 'flush_ob_end');
从本质上说,这应该确保在执行任何其他操作之前先执行重定向之类的操作

嗯,我在代码中遇到了标题问题,例如:

$aisis_unzip_to = ABSPATH . $wp_filesystem->wp_content_dir() . "wp-content/themes/" . get_option('template') . "/";

$this->delete_contents_check();

$aisis_do_unzip = unzip_file($aisis_temp_file_download, $aisis_unzip_to);
unlink($aisis_temp_file_download); 

//Error Checking here - if we pass do the following:

wp_redirect(admin_url('admin.php?page=aisis-core-options'));

关于抛出此错误的原因以及如何解决此问题,请提供任何想法?

通常是行尾或关闭标记后的内容?>在.php文件中,尝试删除?>如果没有此错误,php工作正常,您就不会有此问题。

检查php日志,查看这些解压缩和文件操作过程中的错误。如果你抛出错误,它可能会炸毁整个页面。嗯,它工作正常