Hide Perks from Plugins Page

🧪

Experimental Snippet

This snippet was discovered in the wizard’s chaotic laboratory — an unpolished experiment, conjured to solve a niche challenge. Use at your own risk.

So you’ve installed dozens of perks, each one more useful than the last, but you find that you’d rather not see them all listed individually on your Plugins page. No problem! This snippet will hide perks from your Plugins page.

Note: Perks will still show up on your Updates page.

Instructions

See “Where do I put snippets?” in our documentation for installation instructions.

Code

Filename: gp-hide-perks-from-plugins-page.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
<?php
/**
 * Gravity Perks // Hide Perks from Plugins Page
 * https://gravitywiz.com/documentation/
 *
 * Experimental Snippet 🧪
 *
 * So you've installed dozens of perks, each one more useful than the last, but you find that you'd rather not see them all
 * listed individually on your Plugins page. No problem! This snippet will hide perks from your Plugins page.
 *
 * Note: Perks will still show up on your Updates page.
 */
add_filter( 'all_plugins', function( $plugins ) {

	if ( ! is_callable( 'get_current_screen' ) || get_current_screen()->id !== 'plugins' ) {
		return $plugins;
	}

	$filtered_plugins = array();

	foreach ( $plugins as $slug => $plugin ) {
		if ( ! wp_validate_boolean( rgar( $plugin, 'Perk' ) ) ) {
			$filtered_plugins[ $slug ] = $plugin;
		}
	}

	return $filtered_plugins;
} );

Comments

  1. Gordon
    Gordon September 29, 2025 at 7:24 pm

    “Use at your own risk” is kind of intimidating! The code looks pretty tame, is there something I’m missing? What’s the potential risk/danger? Personally, I’d love it if Spellbook was the only Gravity Wiz plugin and all other functionality got handled through it… which is almost what we have now. My plugin list is super long, but it’s mostly perks! (Which are amazing, by the way – I just don’t need to think about them!)

    Reply
    1. J Yeager
      J Yeager Staff September 29, 2025 at 9:07 pm

      Hey Gordon,

      Thanks for reaching out with the kind words about our Perks! Having Spellbook handle everything is a fascinating idea, and I definitely could see how that would make your plugins page a lot cleaner.

      As far as that warning goes, you’re 100% correct, that might be a bit overkill for this code. The warning isn’t meant to be intimidating, that’s just our generic disclaimer we provide when a snippet we post doesn’t get the full arsenal of testing we would normally run. :)

      We have a lot more “experimental” ones that definitely warrant that message, but for this one, you should have no worries!

      Please just let us know via Support if it’s giving you any issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.