Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress标题已在WP上发送_Wordpress_Header - Fatal编程技术网

Wordpress标题已在WP上发送

Wordpress标题已在WP上发送,wordpress,header,Wordpress,Header,我在我的新主题上使用Ajax scroller,这就是为什么我必须在我的索引页面以及wp-blog-header.php页面中包含一些代码。经过几次修改后,这就是我的wp博客头pge的样子 if ( !isset($wp_did_header) ) { $wp_did_header = true; require_once( dirname(__FILE__) . '/wp-load.php' ); wp(); require_once( ABSPATH . WPINC . '/templ

我在我的新主题上使用Ajax scroller,这就是为什么我必须在我的索引页面以及wp-blog-header.php页面中包含一些代码。经过几次修改后,这就是我的wp博客头pge的样子

if ( !isset($wp_did_header) ) {

$wp_did_header = true;

require_once( dirname(__FILE__) . '/wp-load.php' );

wp();
require_once( ABSPATH . WPINC . '/template-loader.php' );
header("HTTP/1.1 200 OK");}
这段代码非常有用,特别是在代码的最后一行(header(“HTTP/1.1200ok”);)节省了我的时间。但当我使用这段代码时,它在页脚端给出了如下错误:

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/public_html/xxxx/blog/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:221) in /home/xxxx/public_html/xxxx/blog/wp-blog-header.php on line 11
另外,如果禁用该插件,则会出现以下错误:

 Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/public_html/xxx/blog/wp-content/themes/z/header.php:5) in /home/xxxx/public_html/xxxx/blog/wp-blog-header.php on line 11
当我删除它或更改它的行号时,错误会消失,但主题并没有按预期工作

我在我的主题中使用这个代码来调用这个函数

<?php require('/home/xxx/public_html/xxx/blog/wp-blog-header.php'); ?>


有没有办法解决这个问题?谢谢

我遇到了类似的问题,您需要做的就是在
函数.php
文件的前几行中查找,看看在
之外是否有格式为
的注释,如果您正在执行回调请执行以下操作:

我试图重定向到Zoom Oauth Api,我是这样实现的

 if(!isset($_GET['callback'])) {
  include_once get_template_directory() . "/page-templates/meetings/index.php";

  $url = "https://zoom.us/oauth/authorize?response_type=code&client_id=" . CLIENT_ID . "&redirect_uri=" . REDIRECT_URI;
  
  wp_redirect($url);
  exit;
 }

其余的代码都在上面的代码后面

虽然这是多年前的事了,但我最近也遇到了同样的问题

要解决这个问题,首先要确保functions.php文件中没有直接输出标记,因为除非直接输出数据,否则不需要这些标记

最后,确保您的添加操作或添加筛选器正确运行!
最好在函数启动之前放置它。

以及
/home/xxxx/public\u html/xxxx/blog/wp blog header.php中第11行的内容(“HTTP/1.1 200 OK”);所以它已经发送了你想要的相同的标题,我错了吗?但是正如我所说的使用Ajax功能,我在索引页面中调用了两次标题(阅读了很多关于这方面的文章,这是唯一的方法)。如果我不使用第11行,它会给出404错误,并且不会显示任何内容。硬代码调用
header
进入
wp blog header.php
没有任何意义。WordPress将在大多数页面加载时发送该标题。你总是会遇到“头已经发送”的问题,因为你正在发送它们,核心也是如此。此外,在同一个文件中调用blog头两次是没有意义的。您正在加载(或试图加载)所有WordPress两次。那是胡说八道。有人给了你不好的信息,但是你的帖子里没有足够的信息来告诉你该怎么做。