• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Having Issue on Redirecting With Session in WordPress

Resolved: Having Issue on Redirecting With Session in WordPress

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am trying to create a simple login system in WordPress using core PHP but I am getting this error message

Warning: Cannot modify header information – headers already sent by (output started at /www/www/www/wp-content/themes/mytheme/header.php:20) in /www/www/www/wp-content/themes/mytheme/page-solutions.php on line 9


In the header.php template I have
and in the page-solutions.php page

As you can see I am trying to redirect not logged users to front-page.php which I called it Home but I am getting error on header("location: home"); Can you please let me know how to fix this?

Answer:

Functions that modifies headers must be called before any output is made. In this case you’re calling get_header() functions which sends an output, and then youre trying to modify the header. Try changing the order that you execute the code, like this:

If you have better answer, please add a comment about this, thank you!

header php redirect wordpress
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: TYPO3 SQL error: Field ‘tx_imagezoom_set’ doesn’t have a default value

26/03/2023

Resolved: std::regex_replace to replace multiple combinations

26/03/2023

Resolved: How can I copy files using the ansible.builtin.copy module and avoid conflicting file names?

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.