make breacrumb the url

#437560
  • Resolved Hugo Alais
    Rank Math free

    Currently the breadcrumb are my pages title and not the page URL. I want breadcrumbs to be the URL otherwise it looks very messy.

    I’ve submitted a ticket for this before but Rank math support did not help so I’m asking again. I tried the following code but it did not work.

    add_filter( ‘rank_math/frontend/breadcrumb/items’, function( $crumbs, $class ) {
    if(is_singular(‘post’)){
    global $post;
    $page_slug = $post->post_name;
    $crumbs[count($crumbs)-1][0] = $page_slug;
    }
    return $crumbs;
    }, 10, 2);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Nigel
    Rank Math business

    Hello,

    Thank you for contacting Rank Math for help with for help with setting the post URL as breadcrumb.

    The code snippet you shared only sets the post slug as a breadcrump you will need to add the website URL before the post slug. You can use the modified code snippet below:

    
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	if(is_singular('post')){
    		global $post;
    		$page_slug = $post->post_name;
    		$crumbs[count($crumbs)-1][0] = trailingslashit(site_url().'/'.$page_slug);
    		}
    		return $crumbs;
    }, 10, 2);
    

    Hi Nigel,
    Still not working, breadcrumb is still the site title tag.

    Nigel
    Rank Math business

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘make breacrumb the url’ is closed to new replies.