WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Removing 'page' link+separator from breadcrumb trail (5 posts)

  1. Yardco
    Member
    Posted 4 months ago #

    Hello,

    Im trying to filter out a page link from the breadcrumb trail on a website. I've managed to delete it by adding this to the functions.php file:

    function wpseo_remove_home_breadcrumb($links)
    {
    	if ($links[0]['pageurl'] == get_home_url()) { array_shift($links); }
    	return $links;
    }
    add_filter('wpseo_breadcrumb_links', 'wpseo_remove_home_breadcrumb');

    It deletes the link but the separator is still there, resulting in:

    home//page

    Is there a way to also remove the double separator?

    https://wordpress.org/plugins/wordpress-seo/

  2. Alergic
    Member
    Posted 4 months ago #

    What do you think about this one http://wpbacon.com/tutorials/truncate-wordpress-seo-breadcrumbs/
    I changed the limit value to 0. And deleted the three dots.
    $truncated .= '...';

  3. Alergic
    Member
    Posted 3 months ago #

    Sorry, but I didn't manage paying much attention to your topic. Sorry, the previous message is a mistake :(

    Just tested this and it worked for me.
    I removed the line get_home_url(), from the function bellow: wordpress-seo/frontend/class-breadcrumbs.php

    /**
    		 * Add Homepage crumb to the crumbs property
    		 */
    		private function add_home_crumb() {
    			$this->add_predefined_crumb(
    				$this->options['breadcrumbs-home'],
    				get_home_url(),
    				true
    			);
    		}
  4. Yardco
    Member
    Posted 3 months ago #

    Hi alergic,

    Thanks for your replies and my apologies for not replying earlier.

    For some reason my previously posted solution doesn't work any more and am now stuck with the full breadcrumb trail again. Your solution unfortunately doesn't work either, it just deactivates the my home url but doesn't hide it.

    to clarify what im trying to accomplish:

    im using woocommerce and want to eliminate the "products" part in the breadcrumb trail. It now shows:

    home > products > category > category > productname

    I would like to hide or delete the products crumb.

  5. Alergic
    Member
    Posted 3 months ago #

    Your solution unfortunately doesn't work either, it just deactivates the my home url but doesn't hide it.

    If you need that, you better also delete breadcrumbs-home, without the two '' symbols.
    Just tested and worked for me.
    I would also check if Google still display the breadcrumbs in search results. That's why I put back the home breadcrumb. http://www.google.com/webmasters/tools/richsnippets

    Never used woocomerce, but I assume that when you edit a category, WP Seo has also a field for a new category crumb name. Maybe you could try replace with  

Reply

You must log in to post.

About this Plugin

About this Topic