【发布时间】:2020-07-28 01:33:35
【问题描述】:
我做了一些研究来解决这个问题,但似乎对我不起作用,我检查了所有间距,替换了原始 functions.php,仔细检查 wp-config.php 但仍然不适合我。我使用 wordpress 5.4 版本,安装 Elementor Pro 并插入 WP-Filebase 短代码后,出现错误消息。
警告:无法修改标头信息 - 标头已由 /home 中的(输出开始于 /home/customer/www/xxx.xxx/public_html/xxx/wp-includes/class.wp-scripts.php:405)发送/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';
}
【问题讨论】:
-
这是
do_item()函数的一部分,它“处理脚本依赖。”。看起来您的admin-header.php脚本运行得太晚,无法发送header()命令 -
使用 ob_start();在标题之前或之后
-
你想在那里实现什么?为什么此时需要切换到不同的字符编码?
-
@Ravi 插入 ob_start();我的页面变成了空白页面,它应该显示 elementor pro 编辑器页面,这是截图 (khookeiwai.work/error.jpg)
-
@CBroe 我正在尝试将 WP-Filebase 短代码插入到 elementor pro 编辑器中,但是在我插入它之后,出现了错误消息。当我停用 WP-Filebase 插件时,一切正常。我不确定切换到不同的字符编码意味着什么..
标签: php wordpress shortcode elementor