I try to import HTML into wordpress WYSIWYG custom fields and later display it correctly.
The values get written by the importer, but when I try to edit such a content type, the WYSIWYG editor is spammed with html-tags.
I tried different variants to escape the htmlspecialchars. With no succes. The WYSIWYG editor also displays those, instead of formatting the text.
Also, when i do print_custom_field
in my template, the html does not get rendered, but displayed again. Obviously not what I would want.
All related content types are created with custom content type manager
https://code.google.com/p/wordpress-custom-content-type-manager/
My Question:
-
Is it a bad idea in general to import html-snippets from a (trusted) external source?
-
How can I trick the output from worpdress into rendering html for certain fields, instead of displaying it.
This was actually related to the view layer. Since that was not my business, I didn’t care at first.
Turns out, that one has to us
htmlspecialchars_decode
in the templates, because the wordpress-api doeshtmlspecialchars
on import.The following code works fine