dqs66973 2014-08-19 12:46
浏览 13
已采纳

在输出标头之前获取WordPress元数据值

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?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部