Skip to content

Instantly share code, notes, and snippets.

add_filter( 'houzez_property_feed_update_postarr', 'retain_existing_data', 10, 4 );
function retain_existing_data( $my_post, $property, $import_id, $post_id ) {
// Get the existing post object
$existing_post = get_post( $post_id );
if ( $existing_post ) {
// Preserve existing values
$my_post['post_title'] = $existing_post->post_title;
$my_post['post_excerpt'] = $existing_post->post_excerpt;
$my_post['post_content'] = $existing_post->post_content;
add_filter( "houzez_property_feed_properties_due_import_kyero", 'new_build_only', 10, 2 );
add_filter( "houzez_property_feed_properties_due_import_xml", 'new_build_only', 10, 2 );
function new_build_only( $properties, $import_id )
{
$new_properties = array();
foreach ( $properties as $property )
{
if (isset($property->new_build) && (string)$property->new_build == '1')
{
@propertyhive
propertyhive / gist:f0a047c417fe221dc148a9cc4b014998
Created September 27, 2025 10:31
Disable property enquiry emails from sending
add_filter( 'wp_mail', 'stop_property_enquiry_email' );
function stop_property_enquiry_email( $args ) {
if ( isset( $args['subject'] ) && strpos( $args['subject'], 'Property Enquiry' ) !== false ) {
// Return false to completely cancel the email.
return false;
}
return $args;
}
add_action( "houzez_property_feed_property_imported_property_finder", 'fix_duplicate_community', 10, 3 );
function fix_duplicate_community($post_id, $property, $import_id)
{
if (
isset($property->community) &&
isset($property->sub_community) &&
(string)$property->community == (string)$property->sub_community
)
{
$address_parts = array();
@propertyhive
propertyhive / gist:c893b9997380bfdebd115f17a80294a9
Created September 24, 2025 10:25
Disable import failsafe
add_filter( 'propertyhive_property_import_stop_if_no_properties', 'disable_import_failsafe', 10, 2 );
function disable_import_failsafe( $disable, $import_id )
{
return false;
}
@propertyhive
propertyhive / gist:59b14d2a2d7df45e8c5585a433b9f83e
Last active September 20, 2025 15:48
Mandatory reference number field
// Validate before insert/update for the 'property' post type
add_filter('wp_insert_post_data', function ($data, $postarr) {
if (($data['post_type'] ?? '') !== 'property') {
return $data;
}
// Try to read from POST (classic) or meta_input (REST/Gutenberg)
$value = isset($_POST['_reference_number'])
? trim(wp_unslash($_POST['_reference_number']))
: '';
add_filter('propertyhive_property_import_remove_properties_in_php', 'remove_in_php');
function remove_in_php($in_php)
{
return true;
}
@propertyhive
propertyhive / gist:213604e833e673749d080e4717b4f1ec
Created September 8, 2025 11:53
Add office name to enquiry emails
add_filter( 'propertyhive_property_enquiry_property_output', 'customise_property_output_in_enquiry', 10, 2 );
function customise_property_output_in_enquiry( $output, $property_id )
{
$property = new PH_Property((int)$property_id);
$office_name = $property->office_name;
return 'Office: ' . $office_name . '\n' . $output;
}
/* Get parking */
add_action( "propertyhive_property_imported_jupix_xml", 'assign_parking_taxonomy', 10, 2 );
function assign_parking_taxonomy($post_id, $property)
{
wp_suspend_cache_invalidation( true );
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
$parking_types = array();
add_action( 'propertyhive_property_imported_kyero_xml', 'use_nl_description_and_custom_title', 10, 2 );
function use_nl_description_and_custom_title( $post_id, $property ) {
if ( $property->type->en )
{
$property_type = (string)$property->type->en;
}
else
{
$property_type = (string)$property->type;