Skip to content

Instantly share code, notes, and snippets.

@sjaved87
sjaved87 / remove_notices_for_non_admins.php
Created September 19, 2015 09:48
remove notices for all users except admins
function hide_update_noticee_to_all_but_admin_users()
{
if (!current_user_can('update_core')) {
remove_all_actions( 'admin_notices' );
}
}
add_action( 'admin_head', 'hide_update_noticee_to_all_but_admin_users', 1 );
@sjaved87
sjaved87 / disablepluginpersite.php
Last active February 10, 2016 13:57
disable a network enabled plugin for just one or more subsite(s)
<?php
/*
This simple snippet willy disable plugin per site basis.
Replace 2,3,4 with acutal website ID(s) for those you want to disable this plugin
This snippet can also be used to disable any network activated plugin. Only thing you have to do is copy the folder and file name of plugin e.g akismet/akismet.php
*/
add_filter('site_option_active_sitewide_plugins', 'wpmu_modify_sitewide_plugins');
function wpmu_modify_sitewide_plugins($value) {
global $current_blog;
@sjaved87
sjaved87 / gist:b5bc6053e04be0fbe729
Created May 28, 2015 08:34
Remove tinyMCE buttons based on role
if( !function_exists('wpmu_hide_itmes') ):
function wpmu_hide_itmes($buttons)
{
//do not remoe any button if its super admin or pro users
if(current_user_can('pro') or is_super_admin() ) return $buttons;
//Remove the text color selector
$remove = array( 'msp_shortcodes_button', 'wsalestoolbox_tc_button', 'icon' );