Breadcrumb Category Not Coming Elementor

#53050
Viewing 3 replies - 1 through 3 (of 3 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You can add the following code at the end of the functions.php file in your current theme, I have just coded it for you:

    /**
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$ret = $crumbs;
    	if(is_single()){
    		$categories = get_the_category();
    		
    		if (!empty($categories)) {
        		$mainCategory = array(
    				"0"=>esc_html($categories[0]->name),
    				"1"=>esc_url(get_category_link($categories[0]->cat_ID)),
    				"hide_in_scheme"=>false
    			);  
    			
    			array_splice($ret, 1, 0, array($mainCategory)); 
    		}
    	}
    	return $ret;
    }, 10, 2);

    Looking forward to helping you. Thank you.

    Thanks.. It is showing now..

    Alberto
    Rank Math business

    Hello Aditya,

    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)

You must be logged in to reply to this ticket.