Created
November 20, 2025 13:34
-
-
Save g-maclean/0fc1a9a7fbd8719b1340adef5f1243e5 to your computer and use it in GitHub Desktop.
Property Hive - Reapit - use extra address field for location
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_action( "propertyhive_property_imported_reapit_json", 'assign_location_from_extra_field', 10, 2 ); | |
| function assign_location_from_extra_field( $post_id, $property ) { | |
| $location_set = false; | |
| if ( isset( $property['address']['line3'] ) && trim( $property['address']['line3'] ) != '' ) { | |
| $reapit_location = trim( $property['address']['line3'] ); | |
| $term = term_exists( $reapit_location, 'location' ); | |
| if ( $term !== 0 && $term !== null && isset( $term['term_id'] ) ) { | |
| $location_set = true; | |
| wp_set_object_terms( $post_id, array( (int)$term['term_id'] ), 'location' ); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment