Skip Navigation

[Resolved] Displaying Term Meta Custom Fields not working with all categories

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 9 replies, has 3 voices.

Last updated by milanS-3 8 months, 3 weeks ago.

Assisted by: Waqar.

Author
Posts
#2697269
Category 440 Hz - Term meta custom field working fine.png
Category Zubehör - Term meta custom field not working - instead showing content of product.png

Hello,

i created term meta custom fields for my woo commerce product categories.

I use this shortcode to display the value of the custom field:
[types termmeta="einleitung-produktkategorie"][/types]

In most of my categories this works perfectly fine. Like in this category:
hidden link

But in this three categories it does not display the value of the term meta custom field.
- hidden link
- hidden link
- hidden link

In this three categories it displays the content of a product from this category.

Do you have an idea why this happens?

Best regards
Milan

#2697279

Here is the shortcode: [types termmeta="einleitung-produktkategorie"][/types]

#2697352

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Milan

You have shared details of a staging site.

Is it okay for us to do some testing on that site, such as deactivating plugins to isolate the cause?

#2697395

Yes for sure! Thanks for your help!

#2697529

Hi Milan,

During troubleshooting, I noticed that the term field 'Einleitung-Produktkategorie' is of type 'WYSIWYG'. This field's content can be affected by the extra content processing filters, applied by the active theme and the third-party plugins.

I've included the suppress_filters="true" attribute to the term field's shortcode in the templates of the archive pages that you've shared and the field content is showing correctly now:
https://toolset.com/documentation/customizing-sites-using-php/functions/#wysiwyg


[types termmeta="einleitung-produktkategorie" suppress_filters="true"][/types]

You can update the shortcode, in other templates too, where this 'WYSIWYG' field is used.

regards,
Waqar

#2697544

Thank you very much.
Can you perhaps explain this to me in more detail?

I'm surprised that it works perfectly for most categories and not yet for these three.

regards
Milan

#2697545

Glad I could help.

WordPress offers a content filter 'the_content', which is used by WordPress, themes, and plugins to apply formatting and other processing to the long content sections, like post content body and description fields, such as the 'WYSIWYG' fields.
( ref: https://developer.wordpress.org/reference/hooks/the_content/ )

There are many plugins active on your website, so it won't be possible to say for sure. But most likely this extra processing was caused by the Elementor builder, as the archives are using the Elementor templates.

The use of the suppress_filters="true" attribute, ensures that the content of the field is returned exactly as saved in the database, without going through the filter 'the_content'. This means that it is a good practice to always use this attribute when the 'WYSIWYG' field is used in third-party page builders.

The only difference I noticed between the archives where the field was working and where it wasn't was that there were two archive templates from Elementor applied to the ones where the field wasn't working.

#2697563

Thank you very much for the explanation and the info about the two aplied archive templates.
Can you tell me which two templates are applied or how you recognized it?

#2697575

You're welcome and glad I could help.

When you visit any page on the front end, you'll see a menu item from Elementor 'Edit with Elementor', in the top admin bar.
(when you visit logged-in as an administrator)

This lists which templates are being used for the current page.

#2697577

Thank you for the information and your help!