This is very little code snippet that will help you to hide some activity notification from the sitewide activity page. When someone joins in a group, we see a notification in sitewide activity page says, “Someone joined the group ABC”.

Screen Shot 2014-09-26 at 7.43.47 PM

This not that bad, but if your site is attacked by spam users, your activity feed will be flooded with spam notification. So why don’t just hide it? :) Here is the code snippet:

You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

You may also read:  Show posts based on user preference in wordpress

You can do the same for other notification type. If you don’t know the type, in the above code just use:
[php]
print_r($activities);
[/php]

You will get all the types that are coming in your activity field.

Enjoy! :)

Leave a Reply