Location: everywhere
Custom Role Redirect
// Custom Role Redirect / Kiri Vadivelu / 2026 function custom_role_dashboard() { // Replace ‘contractor’ with your actual custom role slug $restricted_role = ‘contractor’; if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) { $current_user = wp_get_current_user(); // Check if…Continue reading
Restrict Role Access
// Restrict Role Access / Kiri Vadivelu / 2026 function restrict_role_access() { // Check if user is trying to access admin area if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) { $user = wp_get_current_user(); // Check for Subscriber or…Continue reading
Untitled Snippet
Advanced Logout Redirect
// Advanced Logout Redirect / Kiri Vadivelu / 2026 add_action(‘wp_logout’, ‘redirect_after_logout’); function redirect_after_logout() { wp_safe_redirect(home_url()); exit; }Continue reading
Advanced Login Redirect
// Advanced Login Redirect / Kiri Vadivelu / 2026 function advanced_login_redirect( $redirect_to, $request, $user ) { if ( isset( $user->roles ) && is_array( $user->roles ) ) { // Role based user redirect if ( in_array( ‘member’, $user->roles ) ) {…Continue reading
Fatal “Class ‘Normalizer’ not found” on the Posts and Pages screens with the Gmail mailer and All in One SEO
// WP Mail SMTP 4.10.0: stop the “Class ‘Normalizer’ not found” fatal on hosts without PHP intl. // Remove once the plugin update with the fix is installed, or once intl is enabled. if ( ! extension_loaded( ‘intl’ ) &&…Continue reading
Progressive Password Field
// Progressive Password Field / Kiri Vadivelu / 2026 add_action(‘login_enqueue_scripts’, ‘field_without_script’); function field_without_script() { echo ‘ ‘; }Continue reading
Disable User Login
// Disable User Login / Kiri Vadivelu / 2026 function disable_user_login( $user ) { if ( is_wp_error( $user ) ) { return $user; } if ( is_a( $user, ‘WP_User’ ) ) { $disabled_user_ids = array( 10 ); // User IDs…Continue reading
Restrict WP Heartbeat
// Restrict WP Heartbeat / Kiri Vadivelu / 2026 add_action( ‘init’, function() { if ( ! is_admin() ) { wp_deregister_script( ‘heartbeat’ ); // Disable heartbeat in frontend } }); add_filter( ‘heartbeat_settings’, function( $settings ) { $settings[‘interval’] = 60; // Set…Continue reading