Custom Screen Option

// Custom Screen Option / Kiri Vadivelu / 2026 function custom_screen_option() { if ( get_current_user_id() !== 1 ) { // Replace your ID return false; } return true; } add_filter( ‘screen_options_show_screen’, ‘custom_screen_option’ );Continue reading

Remove Dashboard Widget

// Remove Dashboard Widget / Kiri Vadivelu / 2026 add_action( ‘wp_dashboard_setup’, ‘remove_dashboard_widget’ ); function remove_dashboard_widget() { // Remove specific widgets by their ID and section remove_meta_box( ‘dashboard_right_now’, ‘dashboard’, ‘normal’ ); // At a Glance remove_meta_box( ‘dashboard_activity’, ‘dashboard’, ‘normal’ ); //…Continue reading

Contributor Default Role

// Contributor Default Role / Kiri Vadivelu / 2026 function contributor_default_role( $default_role ) { return ‘contributor’; // Replace your choice } add_filter( ‘pre_option_default_role’, ‘contributor_default_role’ );Continue reading

test

add_action( ‘admin_notices’, function () { $state = ( defined( ‘WP_DEBUG’ ) && WP_DEBUG ) ? ‘enabled’ : ‘disabled’; echo ‘ WP_DEBUG is ‘ . esc_html( $state ) . ‘. ‘; } );Continue reading

Secure Admin Menu

// Secure Admin Menu / Kiri Vadivelu / 2026 add_action( ‘admin_init’, ‘secure_admin_menu’ ); function secure_admin_menu() { // Replace 1 with the actual User ID of the owner $owner_id = 1; global $user_ID; // 1. If not owner, remove from sidebar…Continue reading

Custom Admin Menu

// Custom Admin Menu / Kiri Vadivelu / 2026 add_action( ‘admin_init’, ‘owner_admin_menu’ ); function owner_admin_menu() { // Replace 1 with the actual User ID of the owner $owner_id = 1; global $user_ID; // If the current user is NOT the…Continue reading

File Upload Type

// File Upload Type / Kiri Vadivelu / 2026 add_filter( ‘upload_mimes’, function( $mimes ) { return array( ‘jpg|jpeg|jpe’ => ‘image/jpeg’, ‘png’ => ‘image/png’, ‘ico’ => ‘image/x-icon’, ‘webp’ => ‘image/webp’, ‘pdf’ => ‘application/pdf’, // ‘mp3’ => ‘audio/mpeg’, // ‘mp4|m4v’ => ‘video/mp4’,…Continue reading

Max Upload Size

// Max Upload Size / Kiri Vadivelu / 2026 function max_upload_size( $file ) { $max = 9 * 1024 * 1024; // 9 MB if ( $file[‘size’] > $max ) { $file[‘error’] = ‘File exceeds the 9 MB maximum upload…Continue reading

Image Max Pixel

// Image Max Pixel / Kiri Vadivelu / 2026 add_filter(‘wp_handle_upload_prefilter’, ‘image_max_pixel’); function image_max_pixel($file) { $image = getimagesize($file[‘tmp_name’]); if ($image[0] > 4000 || $image[1] > 4000) { $file[‘error’] = ‘Image too large (max 4000×4000).’; } return $file; }Continue reading