Created
August 7, 2025 10:46
-
-
Save g-maclean/3b1239f099920eb9947cf05791c5e895 to your computer and use it in GitHub Desktop.
PropertyHive - Jupix - Import parking types
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_action( "propertyhive_property_imported_jupix_xml", 'assign_parking_taxonomy', 10, 2 ); | |
| function assign_parking_taxonomy($post_id, $property) | |
| { | |
| if ( isset($property->parking) && isset($property->parking->type) ) | |
| { | |
| $parking_types = array(); | |
| if (isset($property->parking) && isset($property->parking->type)) { | |
| foreach ($property->parking->type as $type) { | |
| if (trim((string)$type) != '') { | |
| $parking_types[] = sanitize_text_field((string)$type); | |
| } | |
| } | |
| } | |
| if ( !empty($parking_types) ) | |
| { | |
| wp_set_object_terms( $post_id, $parking_types, 'parking', true ); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment