[Resolved] [Plugin: Posts 2 Posts] Update to 1.1.4 causes "Can't determine direction" error
I encounter a situation where posts-to-posts 1.1.4 is outputting an error message that didn’t show up with version 1.1.3.
The message is:
Warning: Can't determine direction in .../plugins/posts-to-posts/core/query-post.php on line 60
Generally the plugin is still working fine. This error occurs only at one place in the theme : a location where the p2p $connected query actually *cannot* return anything. In the previous version there was simply no output, in 1.1.4 I see the error message.
I have three content types: let’s call them posts, custom-type-A (fruits), custom-type-B (vegetables).
p2p is setup to handle reciprocal connections between posts-fruits and posts-vegetables (not between fruits and vegetables). So that’s two possible relations.
The single.php template contains queries for both relations. That’s because WP will use it as default template for posts, fruits, and vegetables.
Now, if we are visiting the page of some fruit – maybe “banana” – the $connected query that is asking for related posts is working OK, but the other query, asking for related vegetables, won’t return anything: that’s normal, since a relation fruit-vegetable isn’t implemented. It was just giving no result with 1.1.3, and it’s now showing the error message in 1.1.4.
The simple solution for me, of course, is to create more specific pages (single-fruit.php, single-vegetable.php, etc). It’s certainly better not to run unnecessary queries anyway.
Regarding the code I’m using for the queries, I simply followed the examples provided here: https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage
- The topic ‘[Resolved] [Plugin: Posts 2 Posts] Update to 1.1.4 causes "Can't determine direction" error’ is closed to new replies.