Single.php back button to deepest level category

by Rosa Bosma   Last Updated December 07, 2017 10:08 AM

If a post is in these categories, the back button needs to link to the deepest level, category AA in this case:

  • Category 1 (top level)
    • Category A (middle level)
      • Category AA (deepest level)

But what I don't know a solution for is a case with multiple deepest levels:

Post is in the following categories:

  • Category 2 (top level)
    • Category B (middle level)
      • Category BB (deepest level)
    • Category C (middle level)
      • Category CC (deepest level)

What are the possible solutions?



Related Questions




in_category on sigle.php not right

Updated September 19, 2017 17:08 PM

How to get category id in single.php wordpress?

Updated October 02, 2018 08:08 AM