-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathacp-export-is_active.php
48 lines (40 loc) · 1.22 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
40
41
42
43
44
45
46
47
48
<?php
/**
* This hooks allows you to disable the export functionality for specific list tables.
*/
/**
* Disable the export functionality on the Uses list table. The `Export` button wil also be removed.
*
* @param bool $is_active
* @param AC\ListScreen $listScreen
*
* @return bool
*/
function acp_disable_export_for_users_list_table($is_active, AC\ListScreen $listScreen)
{
if ($listScreen instanceof AC\ListScreen\User) {
$is_active = 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.
*
* @param bool $is_active
* @param AC\ListScreen $listScreen
*
* @return bool
*/
function acp_disable_export_for_page_list_table($is_active, AC\ListScreen $listScreen)
{
if ($listScreen instanceof AC\ListScreenPost && 'page' === $listScreen->get_post_type()) {
$is_active = 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');