Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created October 23, 2024 11:32
Show Gist options
  • Save propertyhive/a4aa8db61322dd8878251179e3fb0c8d to your computer and use it in GitHub Desktop.
Save propertyhive/a4aa8db61322dd8878251179e3fb0c8d to your computer and use it in GitHub Desktop.
Only import properties from Loop with an image present
add_filter( "propertyhive_loop_json_properties_due_import", 'filter_out_properties_with_no_images', 10, 2 );
function filter_out_properties_with_no_images($properties, $import_id)
{
$new_properties = array();
foreach ($properties as $property)
{
if ( isset($property['images']) && is_array($property['images']) && !empty($property['images']) )
{
// only return if images present
$new_properties[] = $property;
}
}
return $new_properties;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment