0

I'm creating a (calendar) plugin where one feature is the ability to download an event as a .ics-file. To do that I have a file called ics.php in which I generate an .ics-file based on the id of the event, passed by a querystring. So far everything works.

header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=event.ics');
// output...

However, after changing permalink structure from the default to month and name, everytime the file is generated the browser can't find it. (net::ERR_FILE_NOT_FOUND in Chrome, and "File not found" in Firefox).

I can access ics.php but when I add the id of the event to be parsed (ics.php?e=5) I get the above mentioned error. I want the users to be able to use any kind of permalink structure with the plugin, so I need a solution to this.

Maybe worth mentioning is that the events are stored as custom post types.

2
  • how are you calling the file from your plugin? how do you load the WordPress environment from your plugin file if it's called directly?
    – Milo
    Aug 6, 2012 at 16:01
  • I link to it directly: ics.php?e=5 , where 5 is the id of the event. I was including wp-blog-header.php which usually works, but after your comment I changed it to wp-load.php and now it seems to be working. I need to read up on why, but it's working for now, thanks!
    – pbd
    Aug 7, 2012 at 6:22

1 Answer 1

1

I was bootstrapping Wordpress in ics.php by including wp-blog-header.php (which usually works for me), but after changing it to include wp-load.php instead, the files generated were no longer not being found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.