• Resolved Apfelbiss

    (@apfelbiss)


    Hello,

    the snippet shown here works fine in most cases.

    But it doesn’t work for parent pages (therefor are shown in the breadcrumb of the child page) with an “&” in the title. I tried it with & and & amp ; (without spaces) as “$text_to_remove”.

    For WooCommerce shop categories it works with an & amp ; (without spaces) as “$text_to_remove”.

    How can I successfully exclude pages with “&” in the title from the breadcrumb?
    Thank you in advance.

    PS: I also get the problem with the original code. But in my case I changed the code to still get the page title, but as simple text without link. Maybe it is of interest to add this to GitHub as well?

    add_filter( 'wpseo_breadcrumb_single_link' ,'wpseo_remove_breadcrumb_link', 10 ,2);
    function wpseo_remove_breadcrumb_link( $link_output , $link ){
        $text_to_remove = 'Products';
        if( $link['text'] == $text_to_remove ) {
    		$link_output = '<span class="breadcrumb_text">' . $link['text'] . '</span>';
        } 
        return $link_output;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello Apfelbiss

    Thanks for reaching out but we can’t offer support on custom code (needed to change (core) features of our plugin). Since we don’t want to take the risk of breaking your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes. Maybe someone watching these forums can assist you further, but if your topic is inactive for 7 days, we’ll mark it as resolved to keep the overview.

    Thank you for your understanding.

    Thread Starter Apfelbiss

    (@apfelbiss)

    Ok, thank you.

    There was a referral to this support forum in the discussion below the snippet.
    But then I’ll try it there.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with Snippet “Remove a link from the Yoast SEO breadcrumbs”’ is closed to new replies.