Last active
September 21, 2025 10:35
-
-
Save propertyhive/7ecb3b223d38d0820db6e668673420d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 "<p>" 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 "<p>" 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