Home » Php » php – Remove 'home' link from breadcrumb

php – Remove 'home' link from breadcrumb

Posted by: admin July 12, 2020 Leave a comment


I have breadcrumbs such as Home > Instance > Action in all my view pages. How can I remove the ‘Home’ link from all the breadcrumbs?

How to&Answers:

This can be done by setting the homeLink property to false, in your CBreadcrumbs widget initialization. This is usually done in a layout file.

In the default Yii app, in protected/views/layouts/main.php:

<?php if(isset($this->breadcrumbs)):?>
    <?php $this->widget('zii.widgets.CBreadcrumbs', array(
        'homeLink'=>false // add this line
    )); ?><!-- breadcrumbs -->
<?php endif?>


in layouts/main.php add ‘homeLink’ => false

<?= Breadcrumbs::widget([
     'links' => isset($this->params['breadcrumbs'])? $this->params['breadcrumbs'] : [],
     'homeLink' => false
]) ?>