Inventory_Presser_WP_All_Import::set_availability_for_sale( int $post_id, SimpleXMLElement $xml_node, bool $is_update )
set_availability_for_sale
Description
Not all feed imports have a for sale/sold bit that matches up nicely with our Availability taxonomy. Mark vehicles as for sale if no relationship exists in the taxonomy.
Parameters
- $post_id
-
(int) (Required)
- $xml_node
-
(SimpleXMLElement) (Required)
- $is_update
-
(bool) (Required)
Return
(void)
Source
File: includes/integrations/class-wp-all-import.php
public function set_availability_for_sale( $post_id, $xml_node, $is_update ) { $taxonomy = 'availability'; if ( ! empty( wp_get_object_terms( $post_id, $taxonomy ) ) ) { // There is already a relationship return; } // Do we have a For Sale term? $term = get_term_by( 'slug', 'for-sale', $taxonomy ); if ( $term ) { // Yes, create the relationship wp_set_object_terms( $post_id, $term->term_id, $taxonomy ); } }
Expand full source code Collapse full source code View on Github