Created
February 11, 2026 13:49
-
-
Save g-maclean/eac0c7233b6756edff94ec5e9f2a03b6 to your computer and use it in GitHub Desktop.
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_street_json', function( $post_id, $property ) { | |
| wp_suspend_cache_invalidation( true ); | |
| wp_defer_term_counting( true ); | |
| wp_defer_comment_counting( true ); | |
| $is_on_market = false; | |
| if ( isset( $property['lettingsListing'], $property['lettingsListing']['status'] ) ) { | |
| $status = trim( (string) $property['lettingsListing']['status'] ); | |
| $on_market_statuses = ['To Let', 'Available', 'Let Agreed', 'Under Offer']; | |
| $is_on_market = in_array( $status, $on_market_statuses, true ); | |
| } | |
| update_post_meta( $post_id, '_on_market', $is_on_market ? 'yes' : '' ); | |
| wp_suspend_cache_invalidation( false ); | |
| wp_defer_term_counting( false ); | |
| wp_defer_comment_counting( false ); | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment