Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter dmitryosipchuk

    (@dmitryosipchuk)

    SOLVED!

    After some more searching and testing and hair pulling, I found a way to remap some of the fields on import from Rezi, our solution is below just in case anyone else has this/similar issue.

    // Rename post name with property ref
    add_action('propertyhive_property_imported_dezrez_json', 'append_postcode_to_display_address', 10, 2);
    function append_postcode_to_display_address($post_id, $property)
    {
        $newDescription = '';
        foreach ($property['Descriptions'] as $description) {
            // Room Counts
            if ($description['Name'] == 'Main Marketing') {
                $newDescription = $description['Text'];
            }
        }
    
        $my_post = array(
            'ID' => $post_id,
            'post_name' => $property['RoleId'],
            'post_content' => $newDescription,
        );
    
        // Update the post into the database
        $post_id = wp_update_post($my_post);
    }
Viewing 1 replies (of 1 total)