Bug when the same taxonomy is shared between different post types
-
Hello,
your plugin doesn’t work correctly when the same taxonomy is shared between more than one post type.I give you an example.
I have one taxonomy “Tipology” which is used to categorize two custom post types: “Products” and “Accessories”If I order the products of a given tipology term, the wp_postmeta table will contain the ordered ids of the products of that term, but if I try to query the accessories of that term I will have zero results, because the
LEFT JOIN wp_postmeta AS rankpm ON wp_posts.ID = rankpm.post_id
is trying to match the accessories ids in wp_posts with the products ids in wp_postmeta.To solve the problem you need to store also the post_type in wp_postmeta.meta_value like “term_id-post_type”.
For example, if you have to store the ordering of an “accessory” custom post type inside a term with id 10, the wp_postmeta.meta_value should be “10-accessory”.In this way you can have a custom ordering for every custom post type used in shared taxonomy.
What do you think?
In the meantime I would need a way to bypass your plugin, I tried with
'suppress_filters' => true
but your plugin is still changing the query.Thank you!
- The topic ‘Bug when the same taxonomy is shared between different post types’ is closed to new replies.