I am trying to:
Display a Term with a View that lists taxonomy terms
I expected to see:
The Term information
Instead, I got:
No results found
I have a Taxonomy View, it queries a taxonomy
That View has a filter by shortcode attribute.
I insert that View to a archive of the same taxonomy
I want to display the data of a term I pass in the shortcode attribute.
I get no results found.
I tried to pass the Term ID of the current term, and of other terms, always get no results found
If I do not pass a shortcode attribute by term id it shows all term data, but that is not what I want.
Why would a view return no results found when inserted to the archive of the same taxonomy as it is querying?
Note that this is not using a Toolset Archive, it is implanted directly into the PHP template.
The View should in any case return the term data I pass to it with shortcode attribute, or do I get something wrong?
This is how the view is added to the template
$term_id = get_queried_object()->term_id;
$shortcode = '[wpv-view name="single-term-details-for-term-archive" terms="8"]';
echo wpv_do_shortcode($shortcode);
I get "no results found"
Hi Beda, that's odd, I assume you've already tried the standard troubleshooting steps?
- Set cached="off" in the View shortcode to disable Views caching
- Test with only Toolset plugins active
- Test the same View in a Toolset WP Archive for this taxonomy with a default theme and other custom code deactivated
I've set up a similarly-filtered taxonomy View in a local test site in a standard Toolset WP Archive for the same taxonomy, but the View returns the expected term result as seen in the screenshots here, so the problem isn't immediately reproducible in a standard setup. I turned of the WP Archive and created a custom PHP template for the taxonomy archive and placed the same wpv_do_shortcode setup there, and the View is displayed as expected with one result again. Something else must be going on. Can you turn on Views debug mode in Toolset > Settings > Front-end Content and share screenshots of the corresponding debug panels for this taxonomy View?
Well, sure enough it works on a clean install.
No idea what is wrong on the existing live install, other than it has 15K terms and "just a few posts" (like half a million).
Let's forget it. Not worth to duplicate such beast, and on a clean site I can confirm as well it works, I didn't do that when I reported, sorry for this.
On the live site I simply used a custom code now instead of a view, which is likely the better approach anyway
Actually creating the View took longer than writing the Custom Code, because somehow with 15K terms, the Query Filter edit area loads for several minutes until the interactivity is back.
So, win win.
Thanks and sorry the waste of time and ticket!