开发者

How can I intercept and modify HTTP responses with a WordPress plugin?

I'd like to know how to alter an HTTP response within a WordPress plugin, so I can make changes without digging into the WordPress codebase. I have some idea of a technique that might work but I don't know the particulars.

  • Add a function to a hook that happens early on during the processing of a request, and tell PHP to buffer (and not send) data that'开发者_JS百科s written to the response stream until it's been flushed.
  • Add a function to a hook that happens toward the end of the processing of a request, that gets the buffered response, modifies it, and sends it.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜