Wordpress custom hierarchy of breadcrumbs (and no hierarchy of slug / URLs)

admin

Administrator
Staff member
I am trying to create a hierarchy of pages in Wordpress for the breadcrumbs. The simplest way to do it, is by using the "<a href="https://en.support.wordpress.com/pages/page-options/#parent-page" rel="nofollow noreferrer">Parent Page</a>" attribute. However, when using this feature, it also creates a hierarchy in the slugs (which means that change in the hierarchy requires to maintain a list of 301's and changing the internal links in the website).

For example, let's say that I have to following hierarchy:

<blockquote>
<ul>
<li>Water

<ul>
<li>Glass of Water</li>
<li>Bottled Water</li>
</ul></li>
<li>Fire

<ul>
<li>Light a Fire</li>
</ul></li>
</ul>
</blockquote>

The URL for the Glass of Water page will be:
Code:
/water/glass-of-water/
. how can I keep all the slugs "flat", while still have the hierarchy in the breadcrumbs (in this case
Code:
Home &gt; Water &gt; Glass of Water
and keep the url
Code:
/glass-of-water
)?

I found many WP websites that use this practice. For example the following post in the Yoast SEO website:

<a href="https://yoast.com/what-is-storytelling-and-why-should-you-use-it/" rel="nofollow noreferrer">https://yoast.com/what-is-storytelling-and-why-should-you-use-it/</a>

Has the following breadcrumbs:
Code:
Home » SEO blog » Content SEO » What is storytelling and why should you use it?

How can I set a custom breadcrumb hierarchy both for pages and for posts, regardless of the slug?

I use the latest version of Wordpress (Currently 5.3.X), with Yoast SEO plugin, the free version. If needed, I will install other plugins (free of paid), however I am trying to avoid plugins that are not popular or don't have enough reputation.