woocommerce_csv_exporter_fopen_mode │ filter-hook │ WC 6.8.0

Filters the mode parameter which specifies the type of access you require to the stream (used during file writing for CSV exports). Defaults to 'a' (append, write-only, placing the file pointer at the end of the file), which is all CSV export needs and is supported by the widest range of stream wrappers.

Usage

add_filter( 'woocommerce_csv_exporter_fopen_mode', 'wp_kama_woocommerce_csv_exporter_fopen_mode_filter' );

/**
 * Function for `woocommerce_csv_exporter_fopen_mode` filter-hook.
 * 
 * @param string $fopen_mode One of (r, r+, w, w+, a, a+, x, x+, c, c+), optionally followed by
 *                           flags such as "b", "t" or "e". (append, write-only) for broad
 *                           stream-wrapper compatibility.
 *
 * @return string
 */
function wp_kama_woocommerce_csv_exporter_fopen_mode_filter( $fopen_mode ){
	// filter...
	return $fopen_mode;
}
$fopen_mode(string)
One of (r, r+, w, w+, a, a+, x, x+, c, c+), optionally followed by flags such as "b", "t" or "e". (append, write-only) for broad stream-wrapper compatibility.
Default: "a"

Changelog

Since 6.8.0 Introduced.

Where the hook is called

WC_CSV_Batch_Exporter::write_csv_data()
woocommerce_csv_exporter_fopen_mode
woocommerce/includes/export/abstract-wc-csv-batch-exporter.php 155
$fopen_mode = apply_filters( 'woocommerce_csv_exporter_fopen_mode', 'a' );

Where the hook is used in WooCommerce

Usage not found.