Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Last active September 21, 2025 10:35
Show Gist options
  • Save propertyhive/7ecb3b223d38d0820db6e668673420d2 to your computer and use it in GitHub Desktop.
Save propertyhive/7ecb3b223d38d0820db6e668673420d2 to your computer and use it in GitHub Desktop.
add_filter( "propertyhive_rtdf_property_due_import", 'rtdf_remove_html_entities' );
function rtdf_remove_html_entities($property)
{
// Summary
if ( isset($property['details']['summary']) )
{
// 1) Decode any HTML entities (so "&lt;p&gt;" becomes "<p>")
$decoded = html_entity_decode(
$property['details']['summary'],
ENT_QUOTES | ENT_HTML5,
get_bloginfo( 'charset' ) ?: 'UTF-8'
);
// 2) Strip out all HTML tags ("<p>Some text</p>" becomes "Some text"), optional
$property['details']['summary'] = strip_tags( $decoded );
}
// Full description
if ( isset($property['details']['description']) )
{
// 1) Decode any HTML entities (so "&lt;p&gt;" becomes "<p>")
$decoded = html_entity_decode(
$property['details']['description'],
ENT_QUOTES | ENT_HTML5,
get_bloginfo( 'charset' ) ?: 'UTF-8'
);
// 2) Strip out all HTML tags ("<p>Some text</p>" becomes "Some text"), optional
$property['details']['description'] = strip_tags( $decoded );
}
return $property;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment