• Resolved digitalcarla

    (@digitalcarla)


    The following code snippet which prevents post titles from appearing in the breadcrumb output has stopped working in Yoast 17.8:

    add_filter('wpseo_breadcrumb_single_link', __NAMESPACE__ . '\remove_last_breadcrumb' );
    
    function remove_last_breadcrumb( $link_output ) {
        if ( strpos( $link_output, 'breadcrumb_last' ) !== false ) {
            $link_output = '';
        }
        return $link_output;
    }

    I don’t see anything in the change logs related to breadcrumbs. Can you please provide some insight?

Viewing 7 replies - 1 through 7 (of 7 total)
  • @digitalcarla

    I’ve tested the filter wpseo_breadcrumb_single_link with the given code snippet here and it working.

    While I am not familiar with your code snippet, just in case if you’re trying to remove the last item from the breadcrumb, you can try this code snippet written by someone using the same filter, which is actually working.

    Thread Starter digitalcarla

    (@digitalcarla)

    The code snippet I am using is actually listed further down the page on the link you referenced: https://gist.github.com/amboutwe/4b7a2f01366399281a53c355c5b78801/#file-yoast_seo_breadcrumb_remove_title_only-php

    This snippet correctly removes the post title from the HTML output when I roll back to Yoast 17.7, however no longer works with Yoast 17.8.

    Note that the only difference between my code and the code I linked to above is the namespace which would not affect the output.

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi @digitalcarla

    We understand you’ve used this code snippet here and it works with Yoast SEO v17.7 but doesn’t with the latest version of Yoast SEO v17.8.

    Checking the changelog, we also don’t see any changes related to the breadcrumbs. So if you are able to reproduce this issue on a default WP theme (such as TwentyTwenty) and only the Yoast SEO plugin enabled, we recommend that you log a bug report by following the steps here – https://yoast.com/help/how-to-write-a-good-bug-report/

    Thread Starter digitalcarla

    (@digitalcarla)

    Thanks Michael. I’ll get this test happening on a fresh install and circle back shortly!

    Thread Starter digitalcarla

    (@digitalcarla)

    Found and fixed the issue. It wasn’t directly related to breadcrumbs, but rather the removal of the deprecated WPSEO_Frontend class from the Yoast 17.8 codebase.

    The breadcrumb filter in our theme was wrapped in the following check:

    if ( class_exists( 'WPSEO_Frontend' ) )

    After Yoast 17.8, the class was removed, so an alternative way to check is needed:

    if ( function_exists( 'YoastSEO' ) )

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    Thanks for sharing your findings.

    We checked and did see that the deprecated class of WPSEO_Frontend was removed in Yoast SEO v17.8. Upon checking the plugin repository, it looks like this might be reintroduced in a later version of the plugin. However, we’re glad to hear that you were able to resolve the issue accordingly.

    Thanks!

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    We’ll be setting this forum thread to closed.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Breadcrumb code snippet not working with 17.8’ is closed to new replies.