[Resolved] Conditional display of custom fields based on taxonomy doesn’t work anymore
This thread is resolved. Here is a description of the problem and solution.
Problem:
A custom field group is set to display only on posts with a certain taxonomy term assigned, but this has stopped working.
Solution:
This was a bug introduced in Types 3.2.5 which is resolved by updating Types and Access.
This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have grouped different custom fields based on different product categories and set a condition to only show the custom fields on products that are linked to a specific product category. This worked for a while, but I now saw, that it seems to be broken. Now all the custom fields show up on every product despite the product category that it is linked to.
There were improvements to conditional output in the last update for Views, so that amongst other things it is now possible to insert wpv-conditional shortcodes using the GUI which include tests for taxonomies.
This produces shortcodes in a new format, like so:
[wpv-conditional if="( CONTAINS(#(status),'archived') )"]
This is archived
[/wpv-conditional]
Previously it was possible to manually create wpv-conditional shortcodes, but there were inconsistencies as to whether they worked with term names, slugs, or IDs.
It wasn't intended or expected to break existing sites with the changes.
On your site I took a look at the product template where I can see a text block with many conditions, such as
Thanks for your quick feedback. I was only talking about the backend. On the page where you edit the product details.
The custom fields are suppose to show conditional to the product category that is checked.
The attached screenshots show the areas that i am talking about.
The Category "Lautsprecher" is checked, but the custom fields that are linked to different categories show up e.g. (Handapparate, Hand-Mikrofon-Lautsprecher, etc)
In your case the problem arises when assigning the field group to a taxonomy term rather than a template, but the effect is the same, and I have added details of your thread to the internal ticket.
I'm escalating this and will update you when I have further news.
thank you, is there anyway to get a solution within the next 2 days. It is very urgent.
Maybe any of this information will help:
1. It was working a few weeks ago. I can't tell when it stopped working.
2. I have recently deleted some woocommerce related fields like Onsale status and one or two others.
3. I have changed the type of some custom fields.
4. What I find odd is, that when I go the the taxonomy page in the toolset menu, product categories don't show up as taxonomy. Is that normal?
Please let me know if any of this could be related to the problem, or if it just broke due to a recent toolset update.
We will be producing hotfix releases for Types, Views and Forms early next week which bundle together fixes for various issues.
Keep an eye on the erratum I linked to, it may be that a patch is offered to fix the issue.
The issue is nothing you have done, it arises from the update to Types 3.2.5.
Right now the only "fix" would be to revert back to Types 3.2.4, but that also means downgrading Views and Forms if you are using those, because of code that is shared between them.
Previous versions are available from the changelog sections of the downloads page: toolset.com/account/downloads
We released updates to Types, Views, and Forms yesterday afternoon which should fix this, please update and let me know if you continue to have problems.