Guest User

Untitled

a guest
Jul 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. add_action( "propertyhive_property_imported_realla_json", "correct_realla_property_availability", 10, 2 );
  2. function correct_realla_property_availability($post_id, $property)
  3. {
  4. if ( $property['transaction_type'] == 'for_rent' )
  5. {
  6. wp_suspend_cache_invalidation( false );
  7. wp_defer_term_counting( false );
  8. wp_defer_comment_counting( false );
  9.  
  10. if ( isset($property['sale_stage']) && $property['sale_stage'] == 'sold_or_let' ) // Let
  11. {
  12. wp_delete_object_term_relationships( $post_id, 'availability' );
  13. wp_set_post_terms( $post_id, 112, 'availability' );
  14. }
  15.  
  16. wp_suspend_cache_invalidation( true );
  17. wp_defer_term_counting( true );
  18. wp_defer_comment_counting( true );
  19. }
  20. }
Add Comment
Please, Sign In to add comment