Title: Custom fields stripping html
Last modified: August 21, 2016

---

# Custom fields stripping html

 *  Resolved [psorensen](https://wordpress.org/support/users/psorensen/)
 * (@psorensen)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-stripping-html/)
 * Thank you for the great plugin. It’s been quite the life-saver with converting
   a 50,000+ page static site to WP.
 * I am having a similar problem as the one described before, but since the topic
   was resolved in e-mail and not publicly, I’ll address it again.
 * I have a set of pages that include each include a link, which I would like to
   import as a custom field. I am able to identify a unique selector for the link’s
   container, but after import, the custom field is blank. Likely because it strips
   the html of custom fields.
 * The html for the link:
    `<b class="link-container"><a href="link-to-resource"
   >Link To Resource</a></b>`
 * So, when I set a custom field “resource-link” to select the <b> element with 
   a class of “link-container” in the example, the custom field, “resource-link”,
   exists, but it empty.
 * Is there any development on making the stripping optional? Also, I’m not afraid
   to get my hands dirty with the php, so if there’s a temporary fix I can apply,
   I’d be very grateful. **Actually, The ideal solution would be to save the href
   of the link as the custom field.**
 * Thanks again for all the hard work!
 * [http://wordpress.org/plugins/import-html-pages/](http://wordpress.org/plugins/import-html-pages/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [psorensen](https://wordpress.org/support/users/psorensen/)
 * (@psorensen)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-stripping-html/#post-4454546)
 * Figured out a solution for anyone else looking for this:
 * on line 556 of html-importer.php change
 * `$customfields[$fieldname] = strip_tags($content[0]);`
 * to
 * `$customfields[$fieldname] = $content[0]->asXML();`
 * ‘->asXML’ retains html structure. I found this out by looking at the code in 
   the same file for importing post content. Thanks, Stephanie for keeping your 
   plugin well documented!
 *  Plugin Author [Stephanie Leary](https://wordpress.org/support/users/sillybean/)
 * (@sillybean)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-stripping-html/#post-4454645)
 * I’m glad you found that! I’ve sent a modified version of the plugin to someone
   else who needed custom fields with HTML, and I’m planning to include that option
   in a future version. I’ve been ill for several weeks, so it might take me a while
   to catch up on everything, but it’s coming!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom fields stripping html’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/import-html-pages.svg)
 * [HTML Import 2](https://wordpress.org/plugins/import-html-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/import-html-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/import-html-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/import-html-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/import-html-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/import-html-pages/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Stephanie Leary](https://wordpress.org/support/users/sillybean/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-stripping-html/#post-4454645)
 * Status: resolved