Tag Archives: Header

header_remove

It is used to remove previously set headers

<?php
 header("X-Foo: Bar");
 header("X-Bar: Baz");

echo "<pre>";print_r(headers_list());

header_remove("X-Foo"); 
 echo "<pre>";print_r(headers_list());
?>

Output

Array
(
    [0] => X-Powered-By: PHP/7.1.14
    [1] => X-Foo: Bar
    [2] => X-Bar: Baz
)Array
(
    [0] => X-Powered-By: PHP/7.1.14
    [1] => X-Bar: Baz
)
Share

Magento 2 Remove Mini Cart From Header

You can remove Mini Cart from header by adding the below line to layout xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <body>
 <referenceContainer name="header.container">
 <referenceBlock name="minicart" remove="true"/>
 </referenceContainer>
 </body>
</page>
Share

Magento 2 Remove Search From Header

You can remove search from header by adding the below line to layout xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <body>
 <referenceContainer name="header.container">
 <referenceBlock name="top.search" remove="true"/>
 </referenceContainer>
 </body>
</page>
Share