PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.1.91
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.1.91
2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 2.7.1 All 27 releases
insert-php / uninstall.php

uninstall.php in Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts 2.1.91, at uninstall.php

46 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // if uninstall.php is not called by WordPress, die
4 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
5 die;
6 }
7
8 if ( get_option( 'wbcr_inp_complete_uninstall', true ) ) {
9 global $wpdb;
10 $post_type = 'wbcr-snippets';
11 $taxonomy = 'wbcr-snippet-tags';
12
13 $snippets = get_posts( array(
14 'post_type' => $post_type,
15 'post_status' => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ),
16 'numberposts' => - 1
17 ) );
18
19 if ( ! empty( $snippets ) ) {
20 foreach ( (array) $snippets as $snippet ) {
21 wp_delete_post( $snippet->ID, true );
22 }
23 }
24
25 $query = 'SELECT t.name, t.term_id
26 FROM ' . $wpdb->terms . ' AS t
27 INNER JOIN ' . $wpdb->term_taxonomy . ' AS tt
28 ON t.term_id = tt.term_id
29 WHERE tt.taxonomy = "' . $taxonomy . '"';
30
31 $terms = $wpdb->get_results( $query );
32 if ( ! empty( $terms ) ) {
33 if ( ! taxonomy_exists( $taxonomy ) ) {
34 register_taxonomy( $taxonomy, $post_type, array() );
35 }
36 foreach ( $terms as $term ) {
37 wp_delete_term( $term->term_id, $taxonomy );
38 }
39
40 unregister_taxonomy( $taxonomy );
41 }
42
43 // remove plugin options
44 $wpdb->query( "DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE 'wbcr_inp_%';" );
45 }
46