Whenever an administrator in WordPress activates a plugin, upon the reload of the plugin page, a notice will appear upon successful activation reporting “Plugin Activated”.
Is there a way to change this text that appears inside the admin notice, or must I use my own custom message? Additionally, if I must use a custom message, will this suppress the default “Plugin Activated” message?
Related Questions:
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- How to show custom message once on plugin activation?
- What’s the point on gettext syntax?
Duplicate:
Thanks to Pieter for the find:
Additional Resources:
Note
Rememember that although ‘gettext’ filter is only applied during calls to the
translate()
function,translate()
is used by virtually all other i18n functions in i18n.php. These include all of the functions listed here in this post on “Gettext Syntax“.
You can try this:
to modify the message to your likings:
We can refine it further:
If you only want to activate the filter on the
/wp-admins/plugins.php
page, you can use the following instead:with:
where we remove the gettext filter callback as soon we have a match.
If we want to check the number of gettext calls made, before we match the correct string, we can use this:
and I get
301
calls on my install:I can reduce it to only
10
calls:by adding the gettext filter within the
in_admin_header
hook, within theload-plugins.php
hook:Notice that this will not count the gettext calls before the internal redirect used when the plugins are activated.
To activate our filter after the internal redirect we can check the GET parameters used when plugins are activated:
and use like this:
in the previous code example.