Warning: Cannot modify header information – headers already sent by
-
Hello,
when I try to redirect after login using this php-code:
$current_user = wp_get_current_user();
$current_product = $current_user->user_login;
$home = home_url();
$product_page =$home.’/product/’.$current_product.’/’;
header($product_page);I’m getting this warning message:
Warning: Cannot modify header information – headers already sent by (output started at /…/…/wp.content/themes/storefront/header.php:10) in /…/…/wp-content/themes/StorefrontChild/regel_popup.php on line 11.
The header.php from my storefront theme is:
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id=”content”>
*
* @package storefront
*/
?><!doctype html>
<html<?php language_attributes();?>>
<head>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no”>
<link rel=”profile” href=”https://gmpg.org/xfn/11″>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”><?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<?php do_action( ‘storefront_before_site’ ); ?>
<div id=”page” class=”hfeed site”>
<?php do_action( ‘storefront_before_header’ ); ?><header id=”masthead” class=”site-header” role=”banner” style=”<?php storefront_header_styles(); ?>”>
<div class=”col-full”><?php
/**
* Functions hooked into storefront_header action
*
* @hooked storefront_skip_links – 0
* @hooked storefront_social_icons – 10
* @hooked storefront_site_branding – 20
* @hooked storefront_secondary_navigation – 30
* @hooked storefront_product_search – 40
* @hooked storefront_primary_navigation_wrapper – 42
* @hooked storefront_primary_navigation – 50
* @hooked storefront_header_cart – 60
* @hooked storefront_primary_navigation_wrapper_close – 68
*/
do_action( ‘storefront_header’ ); ?></div>
</header><!– #masthead –><?php
/**
* Functions hooked in to storefront_before_content
*
* @hooked storefront_header_widget_region – 10
*/
do_action( ‘storefront_before_content’ ); ?><div id=”content” class=”site-content” tabindex=”-1″>
<div class=”col-full”><?php
/**
* Functions hooked in to storefront_content_top
*
* @hooked woocommerce_breadcrumb – 10
*/
do_action( ‘storefront_content_top’ );I searched with google and found many reasons that could cause the problem (white lines, spaces, echo, etc…). I’ve been trying to solve it for some hours now, but I can’t seem to find what the problem is in my case.
Anyone?
THanks in advance,
David
- The topic ‘Warning: Cannot modify header information – headers already sent by’ is closed to new replies.