Support

Account

Home Forums Front-end Issues ACF plugin is causing "headers already send by…" error Reply To: ACF plugin is causing "headers already send by…" error

  • Thanks for your help. I fixed the code as you suggested, but the same error shows:
    Warning: Cannot modify header information – headers already sent by (output started at /home/customer/www/bermelloajamil.com/public_html/wp-content/themes/bifrost/header.php:1) in /home/customer/www/bermelloajamil.com/public_html/wp-includes/pluggable.php on line 1421

    Here is a snippet of the fixed code:

    <?php
    if (get_field(‘general_redirect’, $bifrost_queried_object) && get_field(‘general_redirect_url’, $bifrost_queried_object)) {
    wp_redirect(get_field(‘general_redirect_url’, $bifrost_queried_object));
    exit;
    }
    ?>
    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset=”<?php bloginfo(‘charset’); ?>”>
    <meta name=”viewport” content=”width=device-width, initial-scale=1″>
    <meta http-equiv=”X-UA-Compatible” content=”ie=edge”>
    <?php
    /**
    * Queried Object
    *
    * In case it is shop page get_queried_object won’t
    * work, it needs to be changed to a custom WooCommerce
    * function wc_get_page_id.
    */
    $bifrost_queried_object = class_exists(‘WooCommerce’) && is_shop() ? wc_get_page_id(‘shop’) : get_queried_object();

    wp_head();
    ?>
    </head>

    Thanks so much for your help!