justintadlock / breadcrumb-trail

Official home of the Breadcrumb Trail plugin for WordPress.
GNU General Public License v2.0
136 stars 61 forks source link

Fix breadcrumb path in edge cases when using Polylang #39

Open timiwahalahti opened 6 years ago

timiwahalahti commented 6 years ago

In some situations with Polylang translation plugin (look like edge cases), the plugin uses wrong post ID in add_post_parents function and that causes breadcrumb to link to the default language. Simple check if Polylang is active and allowing Polylang to check if there are translations available, fixes this issue.

pll_get_post returns the id of the translated post or page as integer.

justintadlock commented 6 years ago

Please see contributing guidelines: https://github.com/justintadlock/breadcrumb-trail/blob/master/contributing.md#pull-requests

Also, this should probably be something that we look at for the Hybrid Breadcrumbs script, which is what the next version of BT will be based on: https://github.com/justintadlock/hybrid-breadcrumbs

Generally speaking, I'm not big on directly adding third-party plugin integration, particularly for plugins that I don't use myself. That leads to more long-term maintenance. I think it's better to open up the code so that it can be altered via filter hook or something similar.

Anyway, feel free to open up a ticket for discussion.