Skip to content

Instantly share code, notes, and snippets.

@vovafeldman
Last active April 29, 2019 10:32
Show Gist options
  • Select an option

  • Save vovafeldman/9729e7a5805331d9238b30d8eaa3bf83 to your computer and use it in GitHub Desktop.

Select an option

Save vovafeldman/9729e7a5805331d9238b30d8eaa3bf83 to your computer and use it in GitHub Desktop.
Controlling the visibility of a Freemius added admin notice
<?php
/**
* @param bool $show
* @param array $msg {
* @var string $message The actual message.
* @var string $title An optional message title.
* @var string $type The type of the message ('success', 'update', 'warning', 'promotion').
* @var string $id The unique identifier of the message.
* @var string $manager_id The unique identifier of the notices manager. For plugins it would be the plugin's slug, for themes - `<slug>-theme`.
* @var string $plugin The product's title.
* @var string $wp_user_id An optional WP user ID that this admin notice is for.
* }
* @return bool
*/
function my_custom_show_admin_notice( $show, $msg ) {
if ('trial_promotion' == $msg['id']) {
// Don't show the trial promotional admin notice.
return false;
}
return $show;
}
my_fs()->add_filter( 'show_admin_notice', 'my_custom_show_admin_notice', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment