Progressive Password Field
// Progressive Password Field / Kiri Vadivelu / 2026 add_action(‘login_enqueue_scripts’, ‘field_without_script’); function field_without_script() { echo ‘ ‘; }Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
// Progressive Password Field / Kiri Vadivelu / 2026 add_action(‘login_enqueue_scripts’, ‘field_without_script’); function field_without_script() { echo ‘ ‘; }Continue reading
// 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 / 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
// Sensitive User Switch / Kiri Vadivelu / 2026 add_filter( ‘user_has_cap’, function( $allcaps, $caps, $args, $user ) { if ( ‘switch_to_user’ === $args[0] ) { // Deny switching to everyone except site owner if ( $user->user_login !== ‘ownerusername’ ) {…Continue reading
// Remove Sensitive Setting / Kiri Vadivelu / 2026 add_action( ‘admin_init’, ‘remove_sensitive_setting’, 999 ); function remove_sensitive_setting() { global $user_ID; if ( $user_ID != 1 ) { // Primary Menus remove_menu_page( ‘options-general.php’ ); // Settings // Secondary Menus remove_submenu_page( ‘themes.php’, ‘site-editor.php’…Continue reading
// Remove Screen Options / Kiri Vadivelu / 2026 function remove_screen_options() { // Check if user has ‘manage_options’ (Admin) OR ‘edit_others_posts’ (Editor) if ( current_user_can( ‘manage_options’ ) || current_user_can( ‘edit_others_posts’ ) ) { return true; // Show Screen Options }…Continue reading
// Publish Future Post / Kiri Vadivelu / 2026 function publish_future_type( $post_data ) { if ( $post_data[‘post_status’] == ‘future’ && $post_data[‘post_type’] == ‘post’ ) { $post_data[‘post_status’] = ‘publish’; } return $post_data; } add_filter(‘wp_insert_post_data’, ‘publish_future_type’); // Remove the automatic future hook…Continue reading
// Unrestricted Admin Access / Kiri Vadivelu / 2026 add_action( ‘admin_init’, ‘restrict_admin_menu’ ); function restrict_admin_menu() { // 1. Define the array of unrestricted users (by email) $unrestricted_users = array( ‘[email protected]’, ‘[email protected]’ ); // 2. Get the current user’s email $current_user…Continue reading
// Remove Custom Submenu / Kiri Vadivelu / 2026 add_action( ‘admin_init’, ‘remove_plugin_submenu’ ); function remove_plugin_submenu() { // Parent: options-general.php // Submenu slug: my-plugin-settings // Tools Submenus remove_submenu_page( ‘tools.php’, ‘wp-rollback’ ); // Settings Submenus remove_submenu_page( ‘options-general.php’, ‘log-emails’ ); }Continue reading