Created
July 10, 2024 23:30
-
-
Save propertyhive/3d482ae5c530a0034a4f12e9689d1823 to your computer and use it in GitHub Desktop.
This file contains 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_rex_json", 'rex_import_stuff', 10, 2 ); | |
function rex_import_stuff($post_id, $property) | |
{ | |
if ( isset($property['listing_agent_1']['name']) && $property['listing_agent_1']['name'] != '' ) | |
{ | |
$args = array( | |
'post_type' => 'agent', | |
's' => $property['listing_agent_1']['name'], | |
'posts_per_page' => 1 | |
); | |
$neg_query = new WP_Query( $args ); | |
if ( $neg_query->have_posts() ) | |
{ | |
while ( $neg_query->have_posts() ) | |
{ | |
$neg_query->the_post(); | |
update_post_meta($post_id, '_agent_id', get_the_ID()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment