urls – Best action hook for placing ical requests

Question

I would like to offer an ical or webcal request on one of my pages. Which hock would be best to intercept the request that comes via URL?

At the moment I use the following hook for this:

add_action ( 'init', 'webcal_events');
function webcal_events ()
{
    
    if ($_SERVER['SCRIPT_URL'] == '/events/webcal')
    {
    header('Content-type: text/calendar; charset=utf-8');
    header('Content-Disposition: inline; filename="events.ics"');
      ... do ICS stuff
    exit(); 

    }
}

0
Regnalf 5 months 2022-03-28T13:25:28-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse