-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathacp-export-is_active.php
39 lines (31 loc) · 1.06 KB
/
acp-export-is_active.php
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
<?php
/**
* This hooks allows you to disable the export functionality for specific list tables.
*/
/**
* Disable the export functionality on the Users list table. The `Export` button wil also be removed.
*/
function acp_disable_export_for_users_list_table(bool $is_active, AC\ListScreen $list_screen): bool
{
// Meta type is 'post', 'term', 'user' or 'comment'
if ('user' === $list_screen->get_meta_type()) {
return false;
}
return $is_active;
}
add_filter('acp/export/is_active', 'acp_disable_export_for_users_list_table', 10, 2);
/**
* Disable the export functionality for a specific `Post Type`, in this the `Page` list table.
*/
function acp_disable_export_for_page_list_table(bool $is_active, AC\ListScreen $list_screen): bool
{
if ('page' === $list_screen->get_post_type()) {
return false;
}
return $is_active;
}
add_filter('acp/export/is_active', 'acp_disable_export_for_page_list_table', 10, 2);
/**
* Disable the export functionality completely for all list tables
*/
add_filter('acp/export/is_active', '__return_false');