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!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG
— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.