I'm writing a sort of 301 redirecting plugin for WordPress, which adds a metabox for each page, where you can enter a URL you want to redirect that page to. The value of this field has to be obtained before the header is output or else it's too late to redirect. Is it possible to get a metabox value before the header is output? How?
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
在输出标头之前获取WordPress元数据值
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
1条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
dougang2749 2014-08-19 13:57关注The ideal place to do this is with a hook into the template_redirect action. The WP object is already set up, and no output has been generated yet.
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
编辑预览轻敲空格完成输入- 显示为
- 卡片
- 标题
- 链接
评论按下Enter换行,Ctrl+Enter发表内容
编辑
预览

轻敲空格完成输入
- 显示为
- 卡片
- 标题
- 链接
报告相同问题?
提交
- 2017-02-23 22:23回答 2 已采纳 Thanks for your helps , I talked to my web hosting manager and they start output_buffering in my h
- 2015-07-29 06:17回答 1 已采纳 Line breaks need to be double-quoted in order for " " to be respected. As the headers are current
- 2016-09-27 09:12回答 1 已采纳 you can hook into the WP SEO 'wpseo_robots' hook like this: <?php // add the filter using an a
- 2021-04-13 19:38秉烛叶谈的博客 WordPress使用多个模板文件来显示【文章】这个文章类型。 处理博客或其文章的任何内容都属于【文章】文章类型。Index.php如果没有其他模板文件,index.php将显示【文章】文章类型。 如许多地方所述,每个主题都必须...
- 2016-09-01 00:07回答 1 已采纳 Found it. ctx.Request.Header.Peek("X-Forwarded-For")
- 2018-04-09 04:58回答 1 已采纳 You are getting this error because you are already outputting content before setting a header. If
- 2021-12-13 08:49回答 1 已采纳 最后没办法了,只能导出所有用户数据,重装系统再把数据导入了。
- 2022-02-28 17:25雨夜不眠的博客 php /** * @package Moodo Zhong * @version 1.0.0 */ /* Plugin Name: Moodo Zhong Plugin URI: http://wordpress.org/plugins/hello-dolly/ Description: 通过插件写API接口的简单方法 Author: Zhong Zhao ...
- 2014-11-14 12:48回答 1 已采纳 You need to set underscores_in_headers on in your nginx config. http://wiki.nginx.org/HttpCoreModu
- 2016-12-29 12:52回答 1 已采纳 So looking closer, I see the headers are separated from the body by 4 newlines... For some odd rea
- 2016-07-26 06:16回答 1 已采纳 First of all add line i records.txt Generate Image Do ob_clean(), it will remove output if warnin
- 2025-01-26 00:46破碎的天堂鸟的博客 PHP和JavaScript在运行环境、用途、语法和性能等方面有显著差异。PHP更适合服务器端开发和复杂后端逻辑处理,而JavaScript则更适合前端开发和用户交互增强。两者可以结合使用,以实现完整的Web应用开发流程。Node.js...
- 2020-08-30 10:02culi3118的博客 aws+wordpressThis tutorial is aimed at WordPress developers who want to add a Google+ login to their WordPress theme. For themes built for eCommerce, forums and other sites that require users to login...
- 2020-09-02 06:56culi3118的博客 wordpress系统配置If you’ve been developing websites with WordPress (including plugin and theme development) chances are you’ve heard these terms: Hooks, Actions, and Filters. These are part of the ...
- 2020-08-28 04:43culh2177的博客 wordpress插件Introduction 介绍 WordPress, as a platform, has moved from only being a blogging platform, to a platform for a wide variety of websites. One major reason for this, is how easily ...
- 2020-06-13 18:24cunjie3951的博客 其中一些与周围的社区有关,一些与WordPress支持的PHP版本有关,其中一些与没有多少人在谈论它有关。 在某种程度上,这还可以。 名称空间和自动加载都不是创建插件所绝对需要的主题。 但是,它们可以提供一种更...
- 2020-06-08 19:04cunjie3951的博客 您将要创造的 您是否曾经使用过Citrix的GoToWebinar?... 尽管这些服务在许多特定方面有所不同,但是我们如何将数据从外部API引入WordPress的总体思路是相同的。 在本文中,我将通过与Citrix的GoToWebi...
- 2020-04-11 15:48玲曦的博客 本文说明 一些你渲染文章时会用到的函数 玲曦在官方基础上整理,言简意赅...下面介绍的是一些在WordPress中常用的标签,根据功能排序。 包含模板文件的标签(Include tags) get_header 页头 get_sidebar 侧栏 get...
- 2017-09-11 01:37weixin_30487701的博客 LNMP环境搭建之php安装,wordpress博客搭建 一、介绍: 1.什么是CGI CGI全称是"通用网关接口"(Common Gateway Interface),HTTP服务器与你的或其它机器上的程序进行"交谈"的一种工具,其程序一般运行在网络服务器...
- 没有解决我的问题, 去提问
联系我们(工作时间:8:30-22:00)
400-660-0108kefu@csdn.net在线客服
- 京ICP备19004658号
- 经营性网站备案信息
公安备案号11010502030143
- 营业执照
- 北京互联网违法和不良信息举报中心
- 家长监护
- 中国互联网举报中心
- 网络110报警服务
- Chrome商店下载
- 账号管理规范
- 版权与免责声明
- 版权申诉
- 出版物许可证
- ©1999-2025北京创新乐知网络技术有限公司