Let me start off by saying that this is an excellent plugin and I haven’t been able to find any contending alternatives (yet!)
The shortcodes in particular allow you to extract very specific sets of posts. However from the documentation I’m a little confused about the usage of the must_include_categories shortcode. In one part of the docs it says that must_include_categories should be a ‘true/false’ flag to indicate the AND logic, whereas in another part of the docs it says that the shortcode should directly list out the categories (rather than reference the taxonomy shortcode).
Would appreciate some clarification on show this shortcode should be used. What I’m basically trying to achieve is to pull only posts that belong to BOTH catA and catB, but so far I’m only able to pull posts that belong to either catA OR catB.
Hi thanks for the quick response. I have tried listing out both categories using the taxonomy param, and then setting must_include_categories=’true’, but what I’m getting is OR logic output rather than AND logic output. So I’m getting posts that just belong to 1 of the 2 categories. Using plugin version 7.1.9. Any ideas?
Hey John, really appreciate the time you took to make the video. It does reaffirm how it works.
I found out why it didn’t work for me. Let me explain my set-up in a way analogous to your demo:
I had TestPostA belonging to both categories CatA and CatB.
I had TestPostB belonging to just category CatB.
When I ran the shortcode [taxonomy=’CatA, CatB’ must_include_categories=’true’] I still got both TestPostA and TestPostB being pulled, contrary to the expected behaviour of just getting TestPostA.
And now here’s what I found: For TestPostB, not only did it belong to a category named “CatB”, but it also had a tag with the identical name, i.e. a TAG called “CatB”.
So to revise the original understanding:
I had TestPostA belonging to both categories CatA and CatB.
I had TestPostB belonging to just category ‘CatB’ BUT also having a TAG ‘CatB’
And this somehow caused the plugin to include TestPostB in the results, despite TestPostB not associated to neither a category nor a tag named ‘CatA’.
To reproduce this in your demo, I suspect that if you add a “Novels” TAG to your Test Post B, it would show up in the results despite the must_include_categories=”true” flag that’s supposed to exclude it.
To avoid the problem now, I’ve simply removed all tags that had identical names to categories, since they were redundant info in my case anyways.
I would be interested to know if this is reproducible on your side, but for now I don’t have any further issues.
I added a tag called history to the post with a category named history and ended up with the same results as you. As for now to fix it (until I get around to updating the plugin) add the argument taxonomy_type='category' and that alleviates the problem.
I have tested the above on my website and it works as should.
For the near future as of now to avoid wrong posts you must use taxonomy_type with only one value. That is taxonomy_type='category' or taxonomy_type='tag' but not taxonomy_type='category,tag' when must_include_categories='true' is set.
Viewing 9 replies - 1 through 9 (of 9 total)
The topic ‘must_include_categories usage’ is closed to new replies.