-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathac-export-render-escape.php
More file actions
43 lines (34 loc) · 1.13 KB
/
ac-export-render-escape.php
File metadata and controls
43 lines (34 loc) · 1.13 KB
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
39
40
41
42
43
<?php
/**
* This hook allows you to alter the exported value when generating a CSV file
*/
// This example disabled sanitation for all columns
add_filter('ac/export/render/escape', '__return_false');
// This example disabled sanitation for all Custom Field Columns
add_filter('ac/export/render/escape', static function ($enabled, AC\Column\Context $column) {
if ($column instanceof AC\Column\CustomFieldContext) {
return false;
}
return $enabled;
}, 10, 2);
// This example disabled sanitation for all columns for specific tables
add_filter(
'ac/export/render/escape',
static function ($enabled, AC\Column\Context $column, AC\TableScreen $table) {
// Check for Post table
if ((string)$table->get_id() === 'post') {
return false;
}
// Check for Page table
if ($table instanceof AC\PostType && $table->get_post_type()->equals('page')) {
return false;
}
// Check for Users table
if ($table->get_id()->equals(new AC\Type\TableId('wp-users'))) {
return false;
}
return $enabled;
},
10,
2
);