I'm trying to create a theme settings export script that base_64 encodes the theme options and lets the user download them as a text file.
I've seen a post (What is the best way to export and import theme options?) that involves checking the query vars and then redirecting the user using the 'template_redirect' action. However, it would appear like this action is only available on the frontend of the site (not in the admin). Adding the action to my constructor for the options framework doesn't do anything.
I'm able to get my function to fire by tying it to 'admin_init', but by that time the headers have already been sent (and I'm unable to specify a Content Description). I get a bunch of "Cannot modify header information" warnings and my export string is dumped to the browser instead of being downloaded.
Is there a way I can add a redirect in the WordPress admin, similar to 'template_redirect', that would let me modify the header information before the default headers have been printed?