user657127
user657127

Reputation:

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.

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:

Upvotes: 1

Views: 5419

Answers (1)

user657127
user657127

Reputation:

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'));?>

Upvotes: 3

Related Questions