forked from soflyy/wp-all-import-action-reference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwp_all_export_csv_headers.php
More file actions
38 lines (33 loc) · 895 Bytes
/
wp_all_export_csv_headers.php
File metadata and controls
38 lines (33 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* ======================================
* Filter: wp_all_export_csv_headers
* ======================================
*
* Manipulate export file headers.
*
* @param $headers - array of header columns.
* @param $export_id - the current export id.
*
* @return array
*/
add_filter( 'wp_all_export_csv_headers', 'wpae_wp_all_export_csv_headers', 10, 2 );
function wpae_wp_all_export_csv_headers( $headers, $export_id ) {
// Code here.
}
// ----------------------------
// Example uses below
// ----------------------------
/**
* Example: remove "Rate Name" column.
*
*/
add_filter( 'wp_all_export_csv_headers', 'wpae_wp_all_export_csv_headers', 10, 2 );
function wpae_wp_all_export_csv_headers( $headers, $export_id ) {
foreach ( $headers as $key => $header ) {
if ( $header == 'Rate Name' ) {
unset( $headers[ $key ] );
}
}
return $headers;
}