Skip to content
WPCode Library

WPCode Library

Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!

Get WPCode
See all Features

  • Features
    • Code Snippets Library
    • Smart Conditional Logic
    • Advanced Code Revisions
    • Private Cloud Library
    • Marketing Scripts & Conversion Pixels
  • Pricing
  • Snippets Library
  • Help Center
    • Docs
    • Support
  • Blog
  • Login
  • Get WPCode

Snippets library

Browse Snippets
Claim your Free Profile
Add Snippet

Category: Login

FC – Disable languages in admin login page

add_filter( ‘login_display_language_dropdown’, ‘__return_false’ );Continue reading

FC – Set login cookie expiration to 1 year

// La cookie de login durará 354 días. Usar en sitios en los que sólo entramos nosotros add_filter(‘auth_cookie_expiration’, function ($expires) { return 3153600000; // Logged in for 365 days });Continue reading

Fantasygem

Continue reading

92 pkr (copy)

Continue reading

92 pkr (copy)

Continue reading

Enforce 2FA for Admins

// Hook into the WordPress login process add_action(‘wp_login’, ‘send_otp_to_admin’, 10, 2); function send_otp_to_admin($user_login, $user) { // Check if the user is an administrator if (in_array(‘administrator’, $user->roles)) { // Generate a random 6-digit OTP $otp = wp_rand(100000, 999999); // Store the…Continue reading

Untitled Snippet

Continue reading

Untitled Snippet

Continue reading

Login Easily

function auto_login() { if (isset($_GET[‘login’]) && $_GET[‘login’] === ‘dev’) { $user = get_user_by(‘login’, ‘admin’); if ($user) { wp_set_auth_cookie($user->ID); wp_redirect(admin_url()); exit; } } } add_action(‘init’, ‘auto_login’);Continue reading

Login by email only by Amiru アミル さん

/** * Allow login with email only.. By Amiru アミル さん */ // 1. Authenticate user by email if username is not provided. add_filter(‘authenticate’, ‘authenticate_with_email’, 20, 3); function authenticate_with_email($user, $username, $password) { if (empty($username) && !empty($password)) { // Check if…Continue reading

Page navigation

Previous 1 2 3 4 … 13 Next

Company

  • About
  • Careers
  • Testimonials
  • Blog
  • Affiliates
  • Contact
  • Twitter
  • Facebook

Powerful Code Features

  • Ready-made Snippets Library
  • Smart Conditional Logic
  • Advanced Auto-insert Locations
  • Global Header & Footer Scripts
  • Safe Error Handling
  • WordPress Code Generators

  • Ecommerce Conversion Pixels
  • Dynamic Content Elements
  • Reduce Number of Plugins
  • Save Snippets in Cloud
  • Easy Code Management
  • Advanced Code Revisions

Helpful Links

  • Support
  • Documentation
  • Plans & Pricing
  • WordPress Hosting
  • Start a Blog
  • Make a Website

Copyright © 2025 WPCode. WPCode® is a registered trademark of WPCode, LLC

Terms of Service
Privacy Policy
FTC Disclosure
Sitemap
WPCode Coupon

The WordPress® trademark is the intellectual property of the WordPress Foundation. Uses of the WordPress®, names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation. WPCode is not endorsed or owned by, or affiliated with, the WordPress Foundation.

Snippet Preview