Created
October 23, 2024 11:32
-
-
Save propertyhive/a4aa8db61322dd8878251179e3fb0c8d to your computer and use it in GitHub Desktop.
Only import properties from Loop with an image present
This file contains 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_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