Top link in magento can be added/removed by creating custom xml files. In this xml file you will add code to remove these top links. You can add/remove top link in magento using following method.
Create custom default.xml file at following path
app/code/[Name_Space]/[Your_Module]/view/frontend/layout
Luma Theme:
If the theme you are using is Luma or extends Luma theme than put the following code in default.xml to remove top link
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <!-- you can easly add New links with following code --> <referenceBlock name="header.links"> <!-- Custom Link --> <block class="Magento\Framework\View\Element\Html\Link" name="contactus.link" after="register-link"> <arguments> <argument name="label" xsi:type="string" translate="false">Custom Link</argument> <argument name="path" xsi:type="string" translate="false">link-1</argument> </arguments> </block> <!-- you can easly Remove links with following code --> <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--> </referenceBlock> </body> </page>
Blank Theme:
If the theme you are using is Blank Theme or extends Blank Theme than put the following code in default.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <!-- you can easly add New links with following code --> <referenceBlock name="top.links"> <!-- Custom Link --> <block class="Magento\Framework\View\Element\Html\Link" name="contactus.link" after="register-link"> <arguments> <argument name="label" xsi:type="string" translate="false">Custom Link</argument> <argument name="path" xsi:type="string" translate="false">custom-link</argument> </arguments> </block> <!-- you can easly Remove links with following code --> <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--> </referenceBlock> </body> </page>
You can also create default.xml in the following location.
<Theme_Dir>/Magento_Theme/layout/default.xml
and put the above code to add/remove links.