reitermarkus
reitermarkus

Reputation: 708

How to remove the default “Plugin activated” message in WordPress?

I have successfully found out how to show a custom message when my plugin is activated, but I don't the default message to appear. Is there a way to do is?

function plugin_activate() {
  add_option('plugin_activated', true);
} register_activation_hook(__FILE__, 'plugin_activate');

function plugin_activated() {
  if(get_option('plugin_activated', false)) {
    delete_option('plugin_activated');
    add_action('admin_notices', create_function('', 'echo 
    \'<div class="updated fade"><p>My plugin is <strong>activated</strong>. <a href="options-general.php?my-plugin">Configure it →</a></div>\';'));
  }
} add_action('admin_init', 'plugin_activated');

Upvotes: 0

Views: 881

Answers (2)

reitermarkus
reitermarkus

Reputation: 708

I have come to the conclusion that this is not necessary nor user-friendly as one can activate multiple plugins at the same time and the personalised message is added as a tooltip.

Upvotes: 1

Dan
Dan

Reputation: 3377

You could just add something like this: echo '<style>div#message.updated{ display: none; }</style>';

There may also be a hook for that, if you want to google around you should find it if it exists.

Upvotes: 1

Related Questions