Skip to content
Advertisement

SQL Export – WordPress plugin DEV

Hi So i have the following code..

JavaScript

Now, it works but doesnt download the file. Saying headers already sent.

headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/~/wp-admin/includes/template.php:1642)

Now i understand that the headers have been sent from my main plugin file already to include javascript and css files that are needed for the plugin i am creating.

JavaScript

How do i go about telling it to load the page again with these headers so my sql dump downloads as a file and not displayed / file created on the server. eg. Press a link or button and to call this function and have those headers added so it downloads the sql dump as a file? please correct me if im totally off track here. Open to suggestions on how to do this.

I am a noob and I have learnt a hell of a lot so far with PHP, mySQL and wordpress creating the different elements to this plugin. Your help will be much appreciated. I have searched an searched, read tutorials but just can’t seem to get it to work.

Advertisement

Answer

I did figure this out just now.

JavaScript

I am using xampp on my local to build this plugin for WP, so replace the mysqldump path to suit your server.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement