繁体   English   中英

警告:无法修改 header 信息 - Wordpress

[英]Warning: Cannot modify header information - Wordpress

我做了一些研究来解决这个问题,但似乎对我不起作用,我检查了所有间距,替换了原始函数。php,仔细检查 wp-config.php 但仍然不适合我。 我使用 wordpress 5.4 版本,安装 Elementor Pro 并插入 WP-Filebase 短代码后,出现错误消息。

警告:无法修改 header 信息 - 已发送的标头(输出开始于 /home/customer/www/xxx.xxx/public_html/xxx/wp-includes/class.wp-scripts.php:405)在 /home/customer/ www/xxx.xxx/public_html/xxx/wp-admin/admin-header.php 在第 9 行>

这是第 405 行的 class.wp-scripts.php

* Filters the HTML script tag of an enqueued script.
*
* @since 4.1.0
*
* @param string $tag    The `<script>` tag for the enqueued script.
* @param string $handle The script's registered handle.
* @param string $src    The script's source URL.
*/
$tag = apply_filters( 'script_loader_tag', $tag, $handle, $src );

if ( $this->do_concat ) {
        $this->print_html .= $tag;
    } else {
        echo $tag;
    }

    return true;
}

这是第 9 行的 admin-header.php

header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
if ( ! defined( 'WP_ADMIN' ) ) {
    require_once __DIR__ . '/admin.php';
}

肮脏的廉价解决方案,在 header 部分添加@。

@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM