WordPress – print Custom Field with HTML content

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.

Read More

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.

Related posts

Leave a Reply

1 comment

  1. 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 does htmlspecialchars on import.

    The following code works fine

    <? print htmlspecialchars_decode(get_custom_field('foo'));?>