Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Last active April 17, 2025 11:58
Show Gist options
  • Save g-maclean/43ddd0fb10f79f496c9595e20e4c3c8e to your computer and use it in GitHub Desktop.
Save g-maclean/43ddd0fb10f79f496c9595e20e4c3c8e to your computer and use it in GitHub Desktop.
ProeprtyHive - Foundations - Use Ref ID as Title
add_action( "propertyhive_property_imported_reapit_foundations_json", 'use_ref_as_post_title', 10, 2 );
function use_ref_as_post_title($post_id, $property)
{
if ( isset($property['id']) && $property['id'] != '' )
{
$new_title = $property['id'];
$my_post = array(
'ID' => $post_id,
'post_title' => wp_strip_all_tags( $new_title ),
'post_name' => wp_strip_all_tags( $new_title )
);
// Update the post into the database
$post_id = wp_update_post( $my_post, true );
}
else{
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment