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
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
// 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 / 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
// Auto Admin Logout / Kiri Vadivelu / 2026 add_filter( ‘auth_cookie_expiration’, ‘short_session_admin’, 10, 3 ); function short_session_admin( $expiration, $user_id, $remember ) { // Only apply the short timeout for administrators if ( user_can( $user_id, ‘manage_options’ ) ) { return 3600;…Continue reading
// Sticky Tag Post / Kiri Vadivelu / 2026 add_action(‘pre_get_posts’, function($query) { if (!is_admin() && $query->is_main_query() && is_tag()) { $sticky_posts = get_option(‘sticky_posts’); if (!empty($sticky_posts)) { add_filter(‘posts_orderby’, function($orderby, $query) use ($sticky_posts) { if (!is_admin() && $query->is_main_query() && is_tag()) { global $wpdb;…Continue reading
// 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
/** * DVA – WooCommerce breadcrumbs * Versie 1.3 * * Doel: * * GEWONE WORDPRESS-PAGINA’S * – Huidige pagina blijft zichtbaar. * – Parent /letters-cijfers/ wordt weergegeven als: * “Letters & Cijfers” * – Parent /baby-kinderkleding/ wordt weergegeven als:…Continue reading
// 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
/** * DVA – Yoast handmatige canonicals veilig opschonen V2 * * Bevat: * – WordPress-pagina’s (page) * – WooCommerce-producten (product) * * Doet niets automatisch. * Na activeren: * Gereedschap > Yoast canonicals opschonen V2 */ add_action( ‘admin_menu’, function()…Continue reading