[Resolved] conditional for empty term meta wysiwyg
This thread is resolved. Here is a description of the problem and solution.
Problem: I'm trying to create a conditional that tests whether or not a Term WYSIWYG field has content.
Solution: There is a known issue with special characters in conditional content, which can break conditionals. As a workaround, convert double-quotes to
& quot;
without the space, and convert single-quotes to
'
Our developers are working on a permanent solution to the problem.
The second syntax won't work because of the nested single quotation marks. The first syntax should work in a View of terms. Can you provide login credentials and tell me where to find this on the front-end?
This is exactly what I have, for reference:
Conditional: [wpv-conditional if="('[types termmeta="book-tax-wysiwyg-1" output="raw"]' ne '')"]it is not empty[/wpv-conditional]
Conditional 2: [wpv-conditional if="('[types termmeta="book-tax-wysiwyg-1" output="raw"]' eq '')"]it is empty[/wpv-conditional]
Christian is currently on holidays today but will return tomorrow to continue with this.
However i've tested the credentials for him and they do seem to work. The next thing I would like for you to provide is the URL where he can quickly see where you have setup this conditional.
This is to ensure that he has all the information that he would need to debug this for you when he gets in.
Okay I see, the solution I had in place only works in simple cases, and certain combinations of quotation marks break the conditional. I'll have to continue working on this tomorrow, I just wanted to give you a quick update.
It turns out there is a known issue with special characters in conditionals: https://wp-types.com/errata/conditionals-including-special-characters-might-fail/
I believe that's why the conditionals here are failing inconsistently between us. In your case, I temporarily deleted most of the content in your WYSIWYG field to remove all quotation marks, and you can see the output here is more like I would expect. I replaced the content for now. It seems that the core issue is the same as the erratum post above, so I have connected this ticket with our internal ticket to resolve that issue. I will keep you posted here as I receive more information. In the meantime, the only workaround I am aware of is to remove special characters from these WYSIWYG fields, or replace " with " in the text content.
I tried to replace all " with " in one of the gates - but it still doesn't work. Doesn't this have something to do with the "s and 's in the conditional?
[wpv-conditional if='("[types termmeta='full-gate-text' output='raw'][/types]" ne "")']
Quick note: Blocks 1.3 / Views 3.3 have been released, and the updated plugins include improvements to the conditional parser system, including a fix for checking for empty tem fields and term fields with special characters.