Breadcrumb code incorrect work

The code stopped working correctly after updating to version 6 of WordPress. Breadcrumb titles are now randomly displayed. How to fix it?

function crumbs_breadcrumbs_new() {

...
  
   if(is_single()){
       echo 'span itemscope itemprop=itemListElement itemtype=http://schema.org/ListItem';
          $categories = get_the_category();
          if($categories[0]){
          echo 'a itemprop=item title='.$categories[0]-name.' href=' . get_category_link($categories[0]-term_id ) . '
                   span itemprop=name'.$categories[0]-name.'/span
                   meta itemprop=position content=2 /
                /a';
          }
       echo '/span raquo; span class=current-crumbs';
       echo wp_html_excerpt(get_the_title(), 40, '...');
       echo '/span';
   }
 
 ...
  

Topic functions Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.