get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s", 'prodtabs_tab' ) ) ); $groups = array(); foreach ( $ids as $id ) { if ( taxonomy_exists( 'post_translations' ) ) { $terms = wp_get_object_terms( $id, 'post_translations', array( 'fields' => 'ids' ) ); $groups = array_merge( $groups, is_array( $terms ) ? $terms : array() ); } foreach ( array( 'language', 'post_translations' ) as $taxonomy ) { if ( taxonomy_exists( $taxonomy ) ) { wp_delete_object_term_relationships( $id, $taxonomy ); } } wp_delete_post( $id, true ); } foreach ( array_unique( array_map( 'intval', $groups ) ) as $term_id ) { wp_delete_term( $term_id, 'post_translations' ); } // Tabs of the products, import marks and the tabs kept for the undo of the import. foreach ( array( '_prodtabs_layout', '_prodtabs_texts', '_prodtabs_yikes_import', '_prodtabs_yikes_backup' ) as $key ) { delete_post_meta_by_key( $key ); } delete_option( 'prodtabs_settings' ); delete_option( 'prodtabs_import' ); delete_option( 'prodtabs_import_settings' ); delete_metadata( 'user', 0, 'prodtabs_welcome_dismissed', '', true ); delete_metadata( 'user', 0, 'prodtabs_yikes_notice_dismissed', '', true ); }; if ( is_multisite() ) { foreach ( get_sites( array( 'fields' => 'ids', 'number' => 0, ) ) as $prodtabs_site ) { switch_to_blog( (int) $prodtabs_site ); $prodtabs_uninstall(); restore_current_blog(); } } else { $prodtabs_uninstall(); }