Q: How to get full slug, including all parent pages I am trying for hours and I managed to get full slug for parent of sub-page when I am on 3rd level sub-page I can not get slug of the top parent page. Example
domain.com/top_page/sub_page/sub_sub_page
I need to get full slug 'top_page/sub_page/sub_sub_page'
I am doing this for language sites that are on sub-domains (individuals sites). These pages have same slug across sub-domains. So I want to link language site that when you are on some given page link to language site will take you to that page in that language (not home page of that language).
example of hyperlink to English language sub-domain:
echo '<a href="en.domain.com/'.get_FULL_SLUG).'">'English'</a>';

Is it possible to get slug of top parent when you are on third level page, sub-sub-page
Hope somebody can help

A: Directly using get_page_uri:
$path = get_page_uri($post_or_id);

Result is e.g. top-level-page/sub-page/current-page. This function is used internally by get_page_link etc.

A: This would replace domain.com/top_page/sub_page/sub_sub_page with /top_page/sub_page/sub_sub_page
$path = str_replace(home_url(),'',get_permalink());

