Skip to content

Commit a4ef12d

Browse files
authored
gp-hide-perks-from-plugins-page.php: Migrated from experimental folder.
1 parent a1c7410 commit a4ef12d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Hide Perks from Plugins Page
4+
* https://gravitywiz.com/documentation/
5+
*
6+
* Experimental Snippet 🧪
7+
*/
8+
add_filter( 'all_plugins', function( $plugins ) {
9+
10+
if ( ! is_callable( 'get_current_screen' ) || get_current_screen()->id !== 'plugins' ) {
11+
return $plugins;
12+
}
13+
14+
$filtered_plugins = array();
15+
16+
foreach ( $plugins as $slug => $plugin ) {
17+
if ( ! wp_validate_boolean( rgar( $plugin, 'Perk' ) ) ) {
18+
$filtered_plugins[ $slug ] = $plugin;
19+
}
20+
}
21+
22+
return $filtered_plugins;
23+
} );

0 commit comments

Comments
 (0)