Sunday, July 29, 2018

Wordpress - print Custom Field with HTML content

HTML is printing as it is.


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



2 comments:

  1. This comment has been removed by the author.

    ReplyDelete

  2. Hello,

    we provide affordable and result-oriented SEO services, please give a chance to serve you.


    Thanks
    Admin: E07.net

    ReplyDelete