breadcrumb Undefined array key “url” in. .. /woodmart-child/functions.php
-
Hello, I have a problem. I have a message on the second page of the product category
(for example Home/ Category /Product category /Page2)
Message breadcrumb
Warning: Undefined array key “url” in /home/ariasoho/theme/www/wp-content/themes/woodmart-child/functions.php on line 21
____________________________________________________________________________
20 function wpseo_remove_breadcrumb_link( $link_output , $links ){
21 $page_src = $links[‘url’];
____________________________________________________________________________
on the first page of products does not have this message.
Hello,
This message may indicate an error with how the breadcrumb URL is being retrieved in your child theme’s functions.php file.
You need to review the custom code you added to the child theme and fix or remove it. It is not caused by the theme itself.
Regards
I use this code to remove “shop” from breadcrumbs.
__________________________________________________________________________________________________
add_filter( ‘wpseo_breadcrumb_single_link’, ‘wpseo_remove_breadcrumb_link’, 10 ,2);
function wpseo_remove_breadcrumb_link( $link_output , $links ){
$page_src = $links[‘url’];
$last_word = basename( $page_src );
$text_to_remove = ‘shop’;
if( $last_word == $text_to_remove ) {
$link_output = ”;
}
return $link_output;
}
___________________________________________________________________________________________
But it only works for 1 page. on page 2, deleting works, but gives an error.
Could you please suggest how to modify the code or can it be done with theme functions or Yoast?
Sorry, but we don’t know what is wrong with this code and fixing bugs caused by extra code is out of our theme support scope.
thanks, I fixed the code. Everything works.
Hello,
Thank you for letting us know that you have resolved the issue with the code in your child theme. If you have any further questions or need assistance with any other theme-related concerns, please feel free to reach out.
Regards