WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '12 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 '12 at 6:22
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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