I am created the Custom header and it is working fine. But include child links also showing. I don't want to show child links. Only my custom code will appear How to do.



namespace Learning\TopHeader\Block;

class Header extends \Magento\Theme\Block\Html\Header{

    protected $_template = 'Learning_TopHeader::custom_header.phtml';



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Theme\Block\Html\Header" type="Learning\TopHeader\Block\Header" />


Custom Header

enter image description here

2 Answers 2


Please add the following code on your default.xml of your theme/module and change accordingly:

  <referenceBlock name="top.links">
    <referenceBlock name="register-link" remove="true" />           <!--for Create Account Link-->
    <referenceBlock name="authorization-link" remove="true" />      <!--for Sign In Link  -->
    <referenceBlock name="wish-list-link" remove="true" />          <!--for WishList Link-->
    <referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->


You can just use

<referenceBlock name="top.links" remove="true" />

in app/design///Magento_Theme/layout/default.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.