Completed
Push — update/flyby-changes-to-docker... ( 7daf5c...12cb92 )
by
unknown
09:02
created

avoid-plugin-deletion.php ➔ disable_plugin_deletion()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 9
nc 2
nop 4
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
add_filter( 'plugin_action_links', 'disable_plugin_deletion', 10, 4 );
3
4
function disable_plugin_deletion( $actions, $plugin_file, $plugin_data, $context ) {
5
6
	// Remove delete link for important plugins
7
	if (
8
		array_key_exists( 'delete', $actions ) &&
9
		in_array(
10
			$plugin_file,
11
			array(
12
				'jetpack/jetpack.php',
13
			)
14
		)
15
	) {
16
		unset( $actions['delete']) ;
17
	}
18
	return $actions;
19
}
20