Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Last active November 11, 2025 12:07
Show Gist options
  • Select an option

  • Save propertyhive/bff6efd2bfc4555b3c36d9ff554a5a82 to your computer and use it in GitHub Desktop.

Select an option

Save propertyhive/bff6efd2bfc4555b3c36d9ff554a5a82 to your computer and use it in GitHub Desktop.
do_action( "propertyhive_property_imported_kato_xml", 'cater_for_sale_and_let', 10, 3 );
function cater_for_sale_and_let( $post_id, $property, $import_id )
{
$types = [];
foreach ($property->availabilities->type as $type) {
$types[] = (string)$type['id'];
}
if (in_array('tolet', $types) && in_array('forsale', $types))
{
wp_suspend_cache_invalidation( true );
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
// Both To Let and For Sale exist!
wp_set_object_terms( $post_id, 34144, 'availability' ); // Replace 34144 with the correct ID
wp_suspend_cache_invalidation( false );
wp_defer_term_counting( false );
wp_defer_comment_counting( false );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment