Breadcrumb: Add Custom Link for Post Types (With Hierarchy)

#516856
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Please try applying the following one instead:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$post_type = get_post_type(get_queried_object());
    
    	if (($post_type == 'your_post_type') ) { //change 'your_post_type' with the slug of your CPT
    		$cpt = ['CustomPost', //replace 'CustomPost' with your CPT name
    		 'https://domain.com/custompost/' //replace with the URL of the CPT page
    		];
    
    	array_splice( $crumbs, 1, 0, array($cpt) );
    	} 
    	return $crumbs;
    }, 10, 2);

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    That is working great, thanks so much.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Breadcrumb: Add Custom Link for Post Types (With Hierarchy)’ is closed to new replies.