-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathac-quick_add-enable.php
More file actions
37 lines (31 loc) · 954 Bytes
/
ac-quick_add-enable.php
File metadata and controls
37 lines (31 loc) · 954 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
<?php
/**
* This hooks allows you to enable Quick Add for a specific List Screen in the Hide on Screen Settings
*/
function ac_quick_add_enable(bool $enabled, AC\TableScreen $table_screen): bool
{
return $enabled;
}
add_filter('ac/quick_add/enable', 'ac_quick_add_enable', 10, 2);
// Anonymous function
add_filter('ac/quick_add/enable', static function (bool $enabled, AC\TableScreen $table_screen): bool {
return $enabled;
}, 10, 2);
/*
* Example hook that enabled quick always for specific post types
*/
add_filter('ac/quick_add/enable', static function (bool $enabled, AC\TableScreen $table_screen): bool {
$enabled_post_types = [
'post',
'page',
'custom_post_type',
];
if ($table_screen instanceof AC\PostType && in_array(
(string)$table_screen->get_post_type(),
$enabled_post_types,
true
)) {
return true;
}
return $enabled;
}, 10, 2);