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

Custom Login Page — wp_signon Headers Already Sent?

You have to hook earlier in the request to log someone in, you can’t do it from a page template because, as the error says, headers have been sent to the browser already, so it’s too late at that point.

<?php   
add_action('template_redirect', 'my_check_login');

function my_check_login(){
    if( is_page('my-login-page') && isset($_POST['email']) ){
        // check input and
        // do my login stuff here   
    }
}

Related Posts:

  1. How to get Login Error messages on a custom template
  2. send_headers don’t work on wordpress multisite
  3. Get ‘Headers already sent’ error for the plugin I am creating when I try to login
  4. Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
  5. How do i ‘deactivate’ a plugin only on a certain page template?
  6. force logged in user to stay in the dashboard
  7. Prevent WordPress from sending set-cookie http header
  8. Redirect default login page to a custom page [duplicate]
  9. Checking url from plugin [duplicate]
  10. How to create a custom wordpress plugin for a specific functionality?
  11. Does WP identify plugin by plugin name or plugin_basename?
  12. switched from query_posts to WP_query, not working now?
  13. Making a plugin only available on the front-end for the logged in super admin
  14. Create entire wordpress as a github repositery?
  15. Help With MySQL to WPDB Query Conversion
  16. When to load auto-login code?
  17. AJAX search posts and pages
  18. How to find the origin of a file upload from within wp_handle_upload?
  19. How would I go about creating a user ranked post popularity page?
  20. CSV file generation failing
  21. How can I force users to a particular subdomain to log in for MU (Multisite)?
  22. Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
  23. Show an image in my header.php
  24. Updating the Drag-To-Share eXtended share URLs?
  25. “Request has expired” with “Make your site social” (Gigya) plugin
  26. finding whether request is for post, and post id
  27. Building plugin with changeable custom post type values…advice needed
  28. How to get all of the activate_plugin action parameters?
  29. __callStatic method handler passed to add_action causes bug in PHP
  30. Enqueue WordPress plugin scripts below all other JS
  31. Display update notification messages like ‘What’s New’
  32. How to add Internationalization in WordPress using Javascript/React?
  33. CRUD and Frontend show from a custom table without shortcode
  34. How to get specific setting by settings_fields()?
  35. Save / Show multi line text in metabox
  36. Creating mySQL procedure with $wpdb
  37. how to disable blockrenderAppender inside all Innerblocks?
  38. why doesn’t this update part of this plugin work? it take me to nothing here page
  39. Redirection of users away from wp-admin (but not administrators)
  40. Headers Content-Security-Policy CSP Major Issue
  41. WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
  42. Using a custom plugin to capture input data via Ajax and PHP
  43. Python with wordpress plugin
  44. Display post lists in 2nd paragraph
  45. Map Custom Registration Fields to WordPress User Roles
  46. Not able to add option in Sub-Menu under page
  47. How to debug error message: Cannot modify header information
  48. How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
  49. Using a post-signup hook to get user details
  50. How to save generated JWT token to cookies on login?
  51. How to apply a patch via plugin?
  52. Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
  53. Disable woocommerce cookies and delete cart data automatically
  54. Ajax contact form widget plugin data not insert in database
  55. link bbpress forum discussion to blogposts
  56. Install Plugin via Code
  57. code is working properly in Core PHP but writing coding in WordPress
  58. Combine scripts from all extensions of the plugin when an extension is activated
  59. Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
  60. Prevent duplicate records in plugin table
  61. Send Custom welcome email to specific user group
  62. woocommerce payment gateway callback not firing [closed]
  63. How to modify WCMP Rest API response?
  64. Fetch Children of Grouped Products Inside WooCommerce Product Loop
  65. White page by using filter template_include
  66. How to fetch products with the price in a page on woocommerce using a form or live search with php
  67. Making a Template for a CPT created by a plugin
  68. Woocommerce dependent plugin
  69. WordPress.org Plugin Directory doesn’t recognise screenshots [closed]
  70. External CSS in WordPress Plugin [closed]
  71. How to check current user before all actions and filters?
  72. Owl Carousel2 image not displaying full width when using Stretch row and content, Stretch row and content(no padding) in wordpress
  73. User Session and Stored Cookies not get removed
  74. New databes tables with – WooCommerce – for developers [closed]
  75. How can I prevent my plugin go development trunk [closed]
  76. Plugin-generated pages use Not Found or Pages Archive templates?
  77. How can I make 2 plugins that include different versions of a framework to both use the latest version?
  78. creating html reusable blocks via shortcodes
  79. Add Plugin options as subpage to Theme options page
  80. Is there any kind of theme on WordPress to sell my own movies?
  81. Image upload and download from front-end
  82. Create a navbar filter that filters by a custom field
  83. Change commission_status paid when withdraw_status vendor is completed
  84. Passing an array from shortcode-function to filter-function
  85. custom payment gateway in woocommerce failed to connect to remote api server
  86. wp_remote_get() returns 403 while file_get_contents() does not
  87. Single API call exposed via shortcode with params
  88. Plugin options page with live preview?
  89. Using SVN to upload plugin created with gutenberg blocks
  90. Force quit running background job
  91. Modifying Author Link to add Author Meta in URL
  92. How to output CMB2 select options from repeated groups select elements?
  93. Creating a Callback URL for WordPress Woocommerce to update Order Status
  94. Get Time Taken By Each Action Hook in WordPress
  95. How to export post 2 posts WordPress plugin data [closed]
  96. 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
  97. WordPress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin
  98. Contributive page where people logged in can write
  99. Best way to maintain and update 3rd-party WP plugin when developer is unresponsive?
  100. get 404 when accessing wp-admin/plugin-install.php
Categories plugins Tags headers, login, plugin-development, plugins
Load images after page load
How do I use pagination in WordPress?

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