Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Created February 11, 2026 13:49
Show Gist options
  • Select an option

  • Save g-maclean/eac0c7233b6756edff94ec5e9f2a03b6 to your computer and use it in GitHub Desktop.

Select an option

Save g-maclean/eac0c7233b6756edff94ec5e9f2a03b6 to your computer and use it in GitHub Desktop.
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