ACF_Admin_Tool_Export::submit_download
submit_download
description
Метод класса: ACF_Admin_Tool_Export{}
Хуков нет.
Возвращает
n/a.
Использование
$ACF_Admin_Tool_Export = new ACF_Admin_Tool_Export(); $ACF_Admin_Tool_Export->submit_download();
Список изменений
| С версии 5.6.3 | Введена. |
Код ACF_Admin_Tool_Export::submit_download() ACF Admin Tool Export::submit download ACF 6.8.8
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 ) . "\r\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped as JSON export.
die;
}