Breadcrumb items don’t reflect TLD of reverse proxied page

#606306
  • Resolved Anonymous
    Rank Math free

    My page is reverse proxied to another URL. Can i know how to change the breadcrumbs to reflect the new URL? Currently what’s happening is:
    Breadcrumb Item 1 has the reverse proxied TLD (changed this in settings)
    Other breadcrumb items contains the original TLD (non reverse proxied one).

    How do i make it such that the other items also contain the reverse proxied TLD

Viewing 1 replies (of 1 total)
  • Hello,

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

    Could you please confirm if you wanted to change the URL of the first crumb in Rank Math breadcrumbs?

    Home >> Crumb1(proxied TLD URL) >> Crumb2(website URL)

    You can also share the actual URL and the URL you wanted to use so we can check.

    Meanwhile, this could be achieved by using and customizing this filter:

    /**
     * Allow changing or removing the Breadcrumb items
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
        if(get_post_type() == 'post') {    //Change this to match the post type name
            $crumbs[1][1] = 'www.my-site.com';   //Change this to your actual proxied TLD or URL
        }
        return $crumbs;
    }, 10, 2);

    And here’s how you can add the filter to your site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how this goes.

    Thank 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 1 replies (of 1 total)

The ticket ‘Breadcrumb items don’t reflect TLD of reverse proxied page’ is closed to new replies.