Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.76k stars 886 forks source link

Category breadcrumbs path lost on posts in 23.1 #21518

Open richardbuff opened 1 month ago

richardbuff commented 1 month ago

Please give us a description of what happened

With version 23.1, if you create a new post and assign it a category, the proper category breadcrumbs trail will not show.

To Reproduce

Step-by-step reproduction instructions

  1. I used a blank WordPress install in Local, running version WP version 6.6.1 and Yoast version 23.1 as the only plugin.
  2. Turn on Yoast with Breadcrumbs for post types > Posts > Categories
  3. Using 2024 default theme, I created a post, assigned it a category, and inserted the [wpseo_breadcrumb] shortcode and the category breadcrumb trail is missing. The same behavior is present using yoast_breadcrumb()
  4. With version 23.1, commenting out the early return in the build function here makes the trail reappear: https://github.com/Yoast/wordpress-seo/blob/trunk/src/builders/indexable-hierarchy-builder.php#L120-L122
  5. I believe that when testing this on a blank install, if you want to see the breadcrumbs break, you need to start with an older version of Yoast that is at least 22.9 and then upgrade. It appears that that if you start with 23.1 or 23.0 and then try to downgrade it still won’t show the breadcrumbs path. But on existing sites, rolling back to an older version of Yoast makes the trail appear.

Technical info

Used versions

josevarghese commented 1 month ago

Hi @richardbuff

Thanks for using the Yoast SEO plugin and for creating the issue. I tested it on my lab site by installing the Yoast SEO 22.9 version and added the breadcrumb shortcode to a post. Then I checked the post and noticed that the category was outputted with the trailing slash (based on my permalink settings) without any issue.

After that, I updated the plugin to 23.2, which is the latest version that was released on the last day, and noticed that the category breadcrumb is still outputted with the trailing slash without any issues. You can find the screencast here for your reference: https://www.loom.com/share/12f7de7f59f045fc86e32b37b9b127ae. Did I missed any step while replicating the issue you have mentioned, please let me know.

richardbuff commented 1 month ago

@josevarghese Thanks for the response. Watch these two screencasts I made. In the first one, you can see on the second test post the breadcrumbs no longer work. In the second video, you can see me rollback and they suddenly start working.

josevarghese commented 4 weeks ago

Hi @richardbuff

Thanks for the video. When I tested with another site, I could confirm this issue with the category missing from the breadcrumbs on the post. I escalated it to our development team internally to take a closer look at this; we will keep you posted.

Thanks for your patience.

josevarghese commented 4 weeks ago

The issue only occurs on non-production websites (like websites generated using WP Local) or when the indexable is disabled, and it does not happen on live sites. That's why I could not replicate it during the initial testing, but it can now be replicated when tested using the Local WP.

wittich commented 3 weeks ago

I spent several hours debugging kind of the same issue with Yoast breadcrumbs that only occurs in local or staging environments. But it took me a while to understand that. It seems that Yoast breadcrumbs rely heavily on the indexables and hierarchy tables, which are typically only generated/updated in production environments.

To reproduce, I used the Yoast Test Helper plugin and clicked "Reset Indexables tables & migrations," which emptied the yoast_indexable and yoast_indexable_hierarchy tables. In a non-productive environment, these tables don't repopulate, leading to incomplete breadcrumbs. For example, instead of showing Home > Parent > Child, it only showed Home > Child. See #21539.

For consistency, breadcrumbs should not produce different results depending on the environment.

aaronware commented 3 weeks ago

I can confirm that this issue has impacted a production environment at least on Pantheon

josevarghese commented 2 weeks ago

@aaronware, can you check whether the wp-config.php is set with the value as the environment variable as development or not? This issue only occurs on websites set as development or local, where the SEO Data Optimization is disabled.

n-dawson commented 1 week ago

We've noticed that posts (or in our case, WooCommerce products) that already have categories assigned to them continue to show the category. If you recategorise the post (product) however, the old category continues to be shown in the breadcrumbs.