Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14.1 - Nested taxonomy breadcrumbs in wrong order (HTML & Schema) #15173

Closed
Djennez opened this issue May 13, 2020 · 1 comment · Fixed by #15175
Closed

14.1 - Nested taxonomy breadcrumbs in wrong order (HTML & Schema) #15173

Djennez opened this issue May 13, 2020 · 1 comment · Fixed by #15175

Comments

@Djennez
Copy link
Member

Djennez commented May 13, 2020

Continuing from #15071 (comment)

The order of breadcrumbs seems to be wrong when a nested taxonomy is selected as the primary (or only) one. I was able to reproduce this with the normal posts, as well as custom posttypes.

  1. Install 14.1
  2. Enable breadcrumbs and set the taxonomy breadcrumb for posts to be category
  3. Create a post category and 2 child categories
  4. Create a new post and assign the 2 childs and set one of them as primary
  5. Either add the [wpseo_scortcode] to the post, or add it to your theme somewhere, and publish the post
  6. Visit the post on the frontend and notice a wrong breadcrumb order in both the HTML output as well as schema.
  7. Edit the post, removing one of the selected childs so that there is only one selected. Save the post
  8. View the post again, the breadcrumb order is wrong as well

These steps can be reproduced on custom posttypes (like the books from the Yoast Test Helper) as well. Adding more nested layers will keep a wrong order in the breadcrumbs:

Home » Level 1.1 » Level 1 » Level » Boss

Instead of

Home » Level » Level 1 » Level 1.1 » Boss

It also looks like the first visit of a post after resetting the indexables shows the breadcrumbs in the right order. Refreshing the page will mess up the order again. This may be due to the first load of a page using the fallback, and not the indexables, to generate the breadcrumbs?

I got this to work correctly by changing this query:

public function find_ancestors( Indexable $indexable ) {
$ancestors = $this->query()
->where( 'indexable_id', $indexable->id )
->order_by_desc( 'depth' )
->find_many();

To use order_by_asc instead of order_by_desc. But this code does not seem to be changed from 14.0.4 (where this does not happen). So I guess it got sorted downstream and that got broken?
The problem is in the fact that the ancestors get stored in a different order in 14.1. Which is why posts created on 14.0.4 are showing correctly. See the linked PR below.

@infazz
Copy link

infazz commented Aug 31, 2021

Is the bug returned? on v17.0 irs till happes, was there on v16.4, and probably also before...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants