Skip to content

Instantly share code, notes, and snippets.

@paulgoodchild
Last active May 21, 2021 11:44
Show Gist options
  • Save paulgoodchild/b8a04d90fde14520b94854d7c5bd20b6 to your computer and use it in GitHub Desktop.
Save paulgoodchild/b8a04d90fde14520b94854d7c5bd20b6 to your computer and use it in GitHub Desktop.
[Shield Security for WordPress] Filter whether the Plugin Security Badge is displayed
<?php
/**
* Note: Only available from Shield v11.2+
*
* Use this filter to tell Shield whether or not the Plugin Security Badge should be displayed or not.
*
* More Info on badge here: https://getshieldsecurity.com/blog/feature-plugin-badge/
*
* For example, you may only want to show the badge if the visitor is not on a mobile (see below).
*
* Note, by using `$show &&` we honour the current setting within the plugin first and foremost.
*/
add_filter( 'shield/show_security_badge', function ( $show ) {
$show = $show && !wp_is_mobile();
// ALWAYS return $show.
return $show;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment