Last active
September 29, 2025 05:49
-
-
Save g-maclean/1793295ae2df31fe843cb862d0e3320d to your computer and use it in GitHub Desktop.
Property Hive - Alto - Assign additional field let type for student properties
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_vebra_api_xml", 'assign_student_let_type', 10, 2 ); | |
| function assign_student_let_type($post_id, $property) | |
| { | |
| $is_student = false; | |
| // Check conditions | |
| if ( isset($property->rm_let_type_id) && strtolower((string)$property->rm_let_type_id) == '3' ) { | |
| $is_student = true; | |
| } | |
| if ( isset($property->type) && stripos(strtolower((string)$property->type), 'student') !== false ) { | |
| $is_student = true; | |
| } | |
| // Update custom field instead of taxonomy | |
| if ( $is_student ) { | |
| update_post_meta($post_id, '_let_type', 'student'); | |
| } else { | |
| update_post_meta($post_id, '_let_type', 'other'); // or delete if you prefer | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment