Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Created January 27, 2026 12:12
Show Gist options
  • Select an option

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

Select an option

Save g-maclean/ee66c1e6db57e9585a88fa2a7bb80f02 to your computer and use it in GitHub Desktop.
Property Hive - WP Residence - assign user based on import ID
add_action( "propertyhive_wpresidence_property_synced", 'set_property_user', 10, 3 );
function set_property_user($property_id, $post_id, $synced)
{
// Import ID => WordPress User ID
$import_to_user_map = array(
'1000000' => 10,
'1000001' => 11,
'1000002' => 12,
);
foreach ($import_to_user_map as $import_id => $user_id) {
$meta_key = '_imported_ref_' . $import_id . '';
if (metadata_exists('post', $post_id, $meta_key)) {
update_post_meta($post_id, 'property_user', $user_id);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment