Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.