Get Role

/*———————————————————————————–*/ /*  GET role /*———————————————————————————–*/ function get_user_role() {     global $current_user;     $user_roles = $current_user->roles;     $user_role = array_shift($user_roles);    […]

Read More

Remove WordPress Admin Bar Menu Items

function dashboard_tweaks() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘wp-logo’); $wp_admin_bar->remove_menu(‘about’); $wp_admin_bar->remove_menu(‘wporg’); $wp_admin_bar->remove_menu(‘documentation’); $wp_admin_bar->remove_menu(‘support-forums’); $wp_admin_bar->remove_menu(‘feedback’); $wp_admin_bar->remove_menu(‘view-site’); } add_action( ‘wp_before_admin_bar_render’, ‘dashboard_tweaks’ ); Reference: http://pastebin.com/Wrk0JPxw

Read More

Remove Admin (User #1) from User list

function your_pre_user_query($user_search) { $user = wp_get_current_user(); if ($user->ID!=1) { global $wpdb; $user_search->query_where = str_replace(‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.ID<>1”,$user_search->query_where); } […]

Read More

Make WordPress Editor Allow iFrames

// make TinyMCE allow iframes add_filter(‘tiny_mce_before_init’, create_function( ‘$a’, ‘$a[“extended_valid_elements”] = “iframe[id|class|title|style|align| frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]”; return $a;’) );

Read More

Add parent page slug to body_class

/*************************************************************** * Function body_class_section * Add the top level page to the body class for coloured sections ***************************************************************/ add_filter(‘body_class’,’body_class_section’); function […]

Read More