INVP::delete_attachments( int $post_id )
Action hook callback. Deletes all a vehicle’s attachments when the vehicle is deleted.
On This Page
Parameters Parameters
- $post_id
-
(int) (Required)
Return Return
(void)
Source Source
File: includes/class-invp.php
global $wpdb; foreach ( $taxonomies->query_vars_array() as $taxonomy ) { $taxonomy_name = str_replace( '-', '_', $taxonomy ); $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ( %s ) ORDER BY t.name ASC", $taxonomy_name ) ); // delete terms. if ( $terms ) { foreach ( $terms as $term ) { $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); } } // delete taxonomy. $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy_name ), array( '%s' ) ); } } /**
Expand full source codeCollapse full source codeView on Github