Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Disable Remember Me in Login Form

The login_form_defaults hook does work, but wp-login.php does not use wp_login_form() which runs the login_form_defaults hook, and instead the “Remember Me” checkbox is echoed like this, hence it’s basically unremovable via PHP or there’s no filter to disable (or an argument to bypass) the echo, or empty/modify the markup.

So that means, if wp_login_form() was used, then your code would have worked.

But on the wp-login.php page, you can disable the “Remember Me” via either CSS or JS, or both:

  • Use CSS to visually hide the checkbox, e.g. using the login_head hook:

    add_action( 'login_head', function () {
        echo '<style>.forgetmenot { display: none !important }</style>';
    } );
    
  • Use JS to completely remove the element, e.g. using the login_footer hook:

    add_action( 'login_footer', function () {
        ?>
            <script>
                try {
                    document.querySelector( '.forgetmenot' ).remove();
                } catch ( err ) {}
            </script>
        <?php
    } );
    

Or just create a custom login page and send users to that page instead when they attempt to login.

That way, you can manually call wp_login_form() and just disable the “Remember Me” as you wish.

Related Posts:

  1. Change “You are now logged out” text
  2. Change username before login
  3. Filters on Login Page
  4. Disable emojicons introduced with WP 4.2
  5. How to remove a filter that is an anonymous object?
  6. WordPress hooks/filters insert before content or after title
  7. How to add defer=”defer” tag in plugin javascripts?
  8. add_action(), add_filter() before or after function
  9. apply_filters(‘the_content’, $content) vs do_shortcode($content)
  10. How do filters and hooks really work in PHP
  11. Trouble understanding apply_filters()
  12. What is the very earliest action hook you can call?
  13. How would one modify the filtering Gutenberg applies to pasted content?
  14. How can I modify the WordPress default widget output?
  15. Add custom options to the wplink dialog
  16. Remove classes from body_class
  17. what is __return_false in filters
  18. Explanation for apply_filters function and its variables
  19. Gutenberg: Is there a way to know if current block is inside InnerBlocks?
  20. How to reorder billing fields in WooCommerce Checkout template? [closed]
  21. Insert HTML just after tag
  22. the_content and is_main_query
  23. Changing WooCommerce Display Price Based on User Role & Category [closed]
  24. How to add a custom CSS class to core blocks in Gutenberg editor?
  25. How to show page content in feed?
  26. wp_headers vs send_headers. When to use each?
  27. Filter any HTTP request URI?
  28. How to Pass External Variables to Filters/Actions
  29. How to filter users on admin users page by custom meta field?
  30. Filter by one custom field, order by another?
  31. Not able to change wp_title using add_filter
  32. How to appending to the_content using add_filter with custom post type?
  33. Query WP REST API v2 by multiple meta keys
  34. No filter of code on switch from html to visual editor, how?
  35. Sanitize and data validation with apply_filters() function
  36. How to modify posts_where filter only for the search query
  37. How to hook a filter to catch get_post_meta when alternate a custom field output?
  38. How to get shortcode’s input values inside a filter?
  39. Removing Image and Caption Dimension Attributes
  40. How to wrap oEmbed-embedded video in DIV tags inside the_content?
  41. How to bulk delete all users with no posts?
  42. How many filter/action hooks are healthy?
  43. WordPress 3.9 – Trouble Editing TinyMCE 4.0
  44. Changing JPEG compression depending on image size
  45. How to add filter with 2 args?
  46. Why is javascript allowed in my post content?
  47. How to use update_{$meta_type}_metadata filter to modify meta value
  48. How to wrap an element around an iframe or embed in content automatically?
  49. Filter specific shortcode output?
  50. WordPress Internal @ Mentions
  51. How to add headers to outgoing email?
  52. Earliest hook to reliably get $post/$posts
  53. Insert new element to array with add_filter
  54. LESS CSS enqueue_style with add_filter to change rel attribute
  55. Is it possible to filter comments in a post so a user can only see the comments they have written?
  56. How to pass/get data to/from the WooCommerce data-product_variations object?
  57. Remove Editor From Homepage
  58. How to modify Contact Form 7 Success/Error Response Output [closed]
  59. Where to hook into post content?
  60. What does (10, 2) mean when used with add_filter
  61. Filter translations (gettext strings) on specific admin pages
  62. Filter username field on registration for profanity and unwanted words
  63. Clarification on filters and hooks
  64. remove_filter( ‘the_content’, ‘wpautop’ ); only for certain post types
  65. At what priority does add_filter overwrite core functions?
  66. Valid characters for actions, hooks and filters
  67. is it possible to add “extra” table nav to edit-tags.php screens?
  68. Advanced Custom Fields and Yoast SEO keyword analysis [closed]
  69. Adding a filter to qTranslate to change display of language chooser
  70. Insert Custom HTML After Shortcode
  71. Modify links when inserted by WYSIWYG editor
  72. Is there a way to add another row to the tinyMCE kitchen sink toggle?
  73. How to hook into unregistering a widget instance?
  74. How to check if a hook is hooked or not?
  75. Completely strip any hidden formatting when pasting into TinyMCE
  76. How can I extend the Gutenberg table block transform to allow colspans/rowspans on pasted table elements?
  77. How to add filter to __() and _e()?
  78. Remove description from on Home
  79. Editing ‘Password Reset’ E-mail
  80. Is it possible to use object in add_action?
  81. add_filter and changing output captions of image gallery
  82. Passing Additional Parameters to add_filter Callable
  83. What hook do I use to edit the post statuses option in admin?
  84. How can I add an Author filter to the Media Library?
  85. Add whitespace between Chinese and other letters
  86. Filter hook before create order WooCommerce
  87. Check if a filter or function has been already been called
  88. Modify WordPress Rest Api Request/Response
  89. How to add some custom HTML into wordpress admin bar?
  90. What do add_filters() and apply_filter() do?
  91. How to add icons to post listing (edit.php) in admin
  92. How to auto-translate custom user roles?
  93. Tiny MCE editor stripping xlink:href parameter from SVG USE tag
  94. Filter media library items by size
  95. xmlrpc_enabled filter not called
  96. Custom Rewrite Rules Not Sticking
  97. post_mime_types Filter not Working in List Mode
  98. Add quick edit fields without custom colum
  99. Prevent 404 when using pre_get_posts to filter an archive page
  100. Include a page template along with add_theme_support()
Categories filters Tags filters, wp-login-form
Responsive Images from S3 has no srcset
How to get related taxonomies based on a category with mysql query?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress