ACF_Admin_Tool_Export::submit_download
submit_download
description
Method of the class: ACF_Admin_Tool_Export{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ACF_Admin_Tool_Export = new ACF_Admin_Tool_Export(); $ACF_Admin_Tool_Export->submit_download();
Changelog
| Since 5.6.3 | Introduced. |
ACF_Admin_Tool_Export::submit_download() ACF Admin Tool Export::submit download code ACF 6.0.4
function submit_download() {
// vars
$json = $this->get_selected();
// validate
if ( $json === false ) {
return acf_add_admin_notice( __( 'No field groups selected', 'acf' ), 'warning' );
}
// headers
$file_name = 'acf-export-' . date( 'Y-m-d' ) . '.json';
header( 'Content-Description: File Transfer' );
header( "Content-Disposition: attachment; filename={$file_name}" );
header( 'Content-Type: application/json; charset=utf-8' );
// return
echo acf_json_encode( $json );
die;
}