Created
March 10, 2025 15:49
-
-
Save g-maclean/34529073472103e29767087af3de54d4 to your computer and use it in GitHub Desktop.
ProeprtyHive - Reapit Foundations filter properties by Reapit office ID on import
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_filter( "propertyhive_reapit_foundations_json_properties_due_import", 'remove_non_auction_properties' ); | |
function remove_non_auction_properties( $properties ) | |
{ | |
$office_ids = array( 1, 2, 3 ); | |
$new_properties = array(); | |
foreach ( $properties as $property ) | |
{ | |
if ( isset( $property['officeIds'] ) && is_array( $property['officeIds'] ) && count( $property['officeIds'] ) > 0 ) | |
{ | |
if(in_array($property['officeIds'][0], $office_ids)) | |
{ | |
$new_properties[] = $property; | |
} | |
} | |
} | |
return $new_properties; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment