ACF_Admin_Tool_Export::submit_download()publicACF 5.6.3

submit_download

description

Метод класса: ACF_Admin_Tool_Export{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$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 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;

}