Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Created August 7, 2025 10:46
Show Gist options
  • Save g-maclean/3b1239f099920eb9947cf05791c5e895 to your computer and use it in GitHub Desktop.
Save g-maclean/3b1239f099920eb9947cf05791c5e895 to your computer and use it in GitHub Desktop.
PropertyHive - Jupix - Import parking types
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