Last active
April 17, 2025 11:58
-
-
Save g-maclean/43ddd0fb10f79f496c9595e20e4c3c8e to your computer and use it in GitHub Desktop.
ProeprtyHive - Foundations - Use Ref ID as Title
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_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