Support » Plugin: Yoast SEO » Breadcrumbs – added / home / *home page title*/

  • Resolved fkoomek

    (@fkoomek)


    Hello.
    After the last update (14.04) on a product page (Woocommerce) I see an extra link added in breadcrumbs. After Home is added title of the home page.
    like: Home / *title of homepage * / category ….

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support devnihil

    (@devnihil)

    This issue may be due to a plugin or theme conflict interfering with the breadcrumbs. Can you try and gather as much information for us as possible? Please perform the following:

    1. Check for conflicts.
    2. Check for JavaScript errors with your console.
    If you find any JavaScript errors related to Yoast SEO or if there is a conflict with a plugin or a theme, you can create a new GitHub issue for our developers. Please report the issue to a third party developer as well.

    Thread Starter fkoomek

    (@fkoomek)

    Hello.
    Thanks for the reply.
    So, I just tested it on a fresh new install of WordPress using Twenty Twenty theme and only Woocommerce and Yoast active.
    It does exactly the same.
    I am adding Breadcrumb by this code:

    add_action('woocommerce_before_main_content', 'my_yoast_breadcrumb', 20, 0);
    if (!function_exists('my_yoast_breadcrumb'))
    {
        function my_yoast_breadcrumb()
        {
            if (!is_shop())
            {
                if (function_exists('yoast_breadcrumb'))
                {
                    yoast_breadcrumb('<p id="breadcrumbs">', '</p>');
                }
            }
        }
    }

    I found out that the extra link always represents Shop Page which is set in Woocoomerce in Woocommerce – settings – products: Shop page.
    So, the structure is: Home (word for homepage set in Yoast) / Shop Page (set in Woocommerce) / …..

    • This reply was modified 3 years, 10 months ago by fkoomek.
    • This reply was modified 3 years, 10 months ago by fkoomek.
    Thread Starter fkoomek

    (@fkoomek)

    Hello.
    So, I finally found out what happened.
    From version 14.3. you changed the default word in breadcrumbs ‘Products’ which always showed like: ‘Home / Products / Product’ and replaced that word with the title of Shop page set in Woocommerce.
    Well, I used the code:

    add_filter( 'wpseo_breadcrumb_links', function( $links ) {
    
        // Check if we're on a WooCommerce page
        // Checks if key 'ptarchive' is set
        // Checks if 'product' is the value of the key 'ptarchive', in position 1 in the links array 
        if ( is_woocommerce() && isset( $links[1]['ptarchive'] ) && 'product' === $links[1]['ptarchive'] ) {
    
            // True, remove 'Products' archive from breadcrumb links
            unset( $links[1] );
        
        }
    
        // Rebase array keys
        $links = array_values( $links );
    
        // Return modified array
        return $links;
    
    });

    to get rid of the word Products.
    But since you changed it, it stopped working. Title of Shop page appeared and I was confused. I changed the code to:

    add_filter( 'wpseo_breadcrumb_links', function( $links ) {
    
        // Check if we're on a WooCommerce page
        // Checks if key 'ptarchive' is set
        // Checks if 'product' is the value of the key 'ptarchive', in position 1 in the links array 
        if ( is_product()) {
    
            // True, remove 'Products' archive from breadcrumb links
            unset( $links[1] );
        
        }
    
        // Rebase array keys
        $links = array_values( $links );
    
        // Return modified array
        return $links;
    
    });
    • This reply was modified 3 years, 10 months ago by fkoomek.
    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    Thanks for sharing the relevant code snippet. We really appreciate it.

    Yoast SEO v14.* releases come with several improvements and as well as deprecates several hooks and filters. Therefore, you or anyone else who have custom code in place will need to update it. More information can be found here https://developer.yoast.com/blog/yoast-seo-14-0-using-yoast-seo-surfaces/

    Plugin Support Jerlyn

    (@jerparx)

    Hi @fkoomek ,

    We’re closing this thread because we haven’t heard back from you in a while. Should you have further questions, please open a new thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Breadcrumbs – added / home / *home page title*/’ is closed to new replies.