Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created September 3, 2025 16:05
Show Gist options
  • Save propertyhive/cab367e7194dbee3b1a26f602e83500a to your computer and use it in GitHub Desktop.
Save propertyhive/cab367e7194dbee3b1a26f602e83500a to your computer and use it in GitHub Desktop.
add_action( "propertyhive_property_imported_agentos_json", "set_new_home_flag", 10, 2 );
function set_new_home_flag( $post_id, $property )
{
if ( isset($property['IsNewHome']) && $property['IsNewHome'] === true )
{
wp_suspend_cache_invalidation( true );
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
wp_set_post_terms( $post_id, 123, 'marketing_flag' ); // Set 123 to term ID of 'New Home' flag set in 'Property hive > Settings > Cutom Fields > Marketing Flags
wp_suspend_cache_invalidation( false );
wp_defer_term_counting( false );
wp_defer_comment_counting( false );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment