Sending Headers (2 posts)

  1. thejoker101
    Posted 9 years ago #

    I'd like to send some headers to the pages before they're written out, ex:

    // Date in the past
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    // always modified
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

    // HTTP/1.1
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);

    // HTTP/1.0
    header("Pragma: no-cache");

    I didn't find any plugins to do this, so I was just going to put one together myself, but I'm not sure what hook to tie into in order to get it to write the headers before writing anything else. Is this possible? I'm on WordPress 1.5

  2. Firas
    Posted 9 years ago #

    All plugins execute before any theme does.

    You don't need to hook it to anything, just execute it in the script and wp will run it. Or you can hook to init.

Topic Closed

This topic has been closed to new replies.

About this Topic