WordPress.org

Forums

Yoast SEO
How do I remove CPT from breadcrumb trail? (4 posts)

  1. jsperl
    Member
    Posted 1 year ago #

    Hi,

    Here is my site showing a post in Custom Post Type "Items":

    http://sccnew.speedofc.com/toolbox/budgeting/

    What I'm looking for is the the breadcrumb trail to read

    Home » Finance » Budgeting

    rather than

    Home » Items » Finance » Budgeting

    Anyone know how to do this?

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

  2. jrf
    Member
    Posted 1 year ago #

    There are a number of filters available which you can use to change the output.

    You'll probably want the wpseo_breadcrumb_single_link filter in this case.

  3. jsperl
    Member
    Posted 1 year ago #

    Thank you Juliette! You wouldn't happen to know of a good tutorial for php beginners on how to use this filter by any chance?

  4. jrf
    Member
    Posted 1 year ago #

    @jsperl, this filter is no different from other filters, so any tutorial on how to create filter functions should do:
    https://www.google.nl/search?q=WordPress+how+to+create+a+filter+function+for+a+filter+hook

    Most important thing to remember is to return the result.

    Basic setup could look like:

    add_filter( 'wpseo_breadcrumb_single_link', 'my_breadcrumb_filter_function' );
    
    function my_breadcrumb_filter_function( $full_link, $link_info ) {
    	/* Do something, for instance:
    	   - test the link info for certain information and clear the $full_link, i.e.:
    	if( $link_info['url'] === 'xyz' ) {
    		$full_link = '';
    	}
    	*/
    	return $full_link;
    }

    You could also have a look at the wpseo_breadcrumb_links filter which is run before the crumbs are converted to links.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.