簡體   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