WC_CSV_Exporter::export_column_headers()protectedWC 3.1.0

Export column headers in CSV format.

Method of the class: WC_CSV_Exporter{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->export_column_headers();

Changelog

Since 3.1.0 Introduced.

WC_CSV_Exporter::export_column_headers() code WC 8.7.0

protected function export_column_headers() {
	$columns    = $this->get_column_names();
	$export_row = array();
	$buffer     = fopen( 'php://output', 'w' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
	ob_start();

	foreach ( $columns as $column_id => $column_name ) {
		if ( ! $this->is_column_exporting( $column_id ) ) {
			continue;
		}
		$export_row[] = $this->format_data( $column_name );
	}

	$this->fputcsv( $buffer, $export_row );

	return ob_get_clean();
}