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

Get ‘Headers already sent’ error for the plugin I am creating when I try to login

Your syntax is wrong. You have a closing PHP tag where there is no opening PHP tag at the end of the script. This means you are creating output before the headers are being sent.

Change this:

function prodmanager_html_page() {
?>

<div>

<h2>Product Manager</h2>
<!--usual HTML and PHP Code--> 
</div>
?>

To this:

function prodmanager_html_page() {
    ?>
    <div>
        <h2>Product Manager</h2>
        <!--usual HTML and PHP Code--> 
        </div>
    <?php
}

You do not need a closing PHP tag at the end of your script. This is a good practice to help safeguard against stray whitespace after the closing tag which will give WP a white screen of death.

Related Posts:

  1. How can I make content disappear when a user logs in?
  2. How to send “Location” header on plugin form submit event?
  3. send_headers don’t work on wordpress multisite
  4. WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
  5. My single.php page does not show the related data to the post which is clicked
  6. Custom Login Page — wp_signon Headers Already Sent?
  7. Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
  8. Plugin or ways to limit number of users logging in the website,
  9. Prevent WordPress from sending set-cookie http header
  10. Modifying server’s response to API endpoint
  11. Update Option Error: Notice: Undefined index
  12. How can I display a contact form for out of stock products in WooCommerce?
  13. Pass a php string to a javascript variable
  14. get shortcode value
  15. Cannot login to ADMIN even after changing password in phpmyadmin
  16. How to get number of Affected rows from wordpress dbDelta() function
  17. Show price with Geo IP location
  18. WordPress Ajax Callback
  19. Add category to body class
  20. The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
  21. Plugin Development sqlite or WordPress’ database
  22. How to review WordPress website php version compatibility?
  23. printf – problem to understand code
  24. Custom Post Type Plugin not loading category template and loading 404 instead
  25. Sending email from inside a plugin using PHP PEAR
  26. Auto delete WordPress users according to time
  27. How to cancel WordPress’ action/filter when using OOP with anonymous callback
  28. WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
  29. How to trigger $_GET request within admin plugin page?
  30. Wp favorite posts get user favorites in profile using buddypress [closed]
  31. Storing Options in a Shortcode
  32. Why isn’t admin_notices displaying my text? [Simple Plugin, Beginner]
  33. How to generate video out of images via WordPress plugin
  34. How do i login when i cant access wp-login.php?
  35. How can I get WordPress to save comments in markdown format?
  36. add_query_arg not working
  37. problems with wordpress and php version 5.3.3-1
  38. WooCommerce get_price returning wrong price when used via ajax
  39. How to ‘clone’ a wp plugin to make small changes
  40. Open Post Thumbnail in New Child Theme File in WordPress
  41. add mediaelement.js plugins into WordPress video player control bar
  42. Shortcode button dosent work for all posts. Work for first post only
  43. Where should I save an API key of my user when installing my plugin?
  44. Prevent a plugin from being automatically activated
  45. Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
  46. Programatically download a plugin
  47. Accessing post’s meta data based on user’s click of a post
  48. Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
  49. Preferred way of cacheing a value in php
  50. Redirecting to home page after login as custom role WordPress
  51. How to Use Parameters with a Do_Action Function Within PHP Tags
  52. Add keywords meta to index.php page
  53. Custom form action to handle data inside a plugin
  54. How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
  55. Add Product Subtitle to Woocommerce Product Page
  56. Why is my staging subdomain not sending wordpress_logged_in cookies?
  57. Self deactivate plugins after an action occurs
  58. wp_redirect() not working in Insert PHP plugin in WordPress
  59. Download any file after submitting a form [closed]
  60. Pulling data from custom plugin settings using PHP shortcode and Javascript
  61. woocommerce 3.2.1 not sending order notification emails
  62. WordPress takes too much time (100 seconds) to load – Front end and back end
  63. WordPress on AWS with ELB
  64. Saving changes in wp_editor
  65. Single central login for front end users from any site
  66. Executing my function once on a specific time
  67. Set Post Format if find a string in title or post content
  68. Display data on Word Press site posts and pages from mysql table
  69. Notepad sticky plugin
  70. Output array into one table cell
  71. WooCommerce Custom Product to checkout
  72. How to periodically scrape and cache strings from remote txt files. – My First Plugin
  73. How to stop or remove an action being called inside a function of an extended class
  74. Automatically add attributes to woocommerce product?
  75. WP Post Template – Templates in own folder
  76. Headers already sent when I try to add headers via a shortcode
  77. Apple push notification doesn’t work
  78. Avoid class name collision when using third party libraries in plugins?
  79. Adding an Options Page to a Plugin
  80. how to change the verification url of pie register plugin of wordpress?
  81. How do I “get the next 10 posts after post_id == x”?
  82. wordpress plugin is not activating from widget
  83. How to access data in wordpress database externally using php
  84. How make a php script run only with wp-cron
  85. How to add equivalent of php include to one page (as plugin?)
  86. Theme my Login plugin, how to update fields
  87. WordPress repository forbids me call wp-load.php in non-WordPress file
  88. Edit Yoast SEO breadcrumbs output [closed]
  89. CSS from textarea in options page to frontend what to do
  90. How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?
  91. Adding a slider captcha to the comment system
  92. Date calculations from 2 custom fields
  93. How do I pass a post ID to the page URL?
  94. How to sanitize uploaded file filename from a plugin?
  95. Using WP Category Lists Plugin to Dynamically Display Category (PHP)
  96. How to put JQuery/Ajax inside shortcode?
  97. Plugins Page invisible / white
  98. Error with Image Slide plug-in/ s3slider in WP
  99. How would I go about creating a user ranked post popularity page?
  100. WordPress: PHP code rendering in the wrong place
Categories plugins Tags headers, login, php, plugins
Why won’t pagination work?
WP_editor doesnt apply wpautop on single line content

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