PluginProbe
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 1.1.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v1.1.2
3.6.1 3.6.0 3.5.3 3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 165 releases
everest-forms / uninstall.php
uninstall.php
47 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 * EverestForms Uninstall
4 *
5 * Uninstalls the plugin deletes user roles, tables, and options.
6 *
7 * @package EverestForms\Uninstaller
8 * @version 1.0.0
9 */
10
11 defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
12
13 global $wpdb;
14
15 wp_clear_scheduled_hook( 'everest_forms_cleanup_sessions' );
16
17 /*
18 * Only remove ALL data if EVF_REMOVE_ALL_DATA constant is set to true in user's
19 * wp-config.php. This is to prevent data loss when deleting the plugin from the backend
20 * and to ensure only the site owner can perform this action.
21 */
22 if ( defined( 'EVF_REMOVE_ALL_DATA' ) && true === EVF_REMOVE_ALL_DATA ) {
23 include_once( dirname( __FILE__ ) . '/includes/class-evf-install.php' );
24
25 // Roles + caps.
26 EVF_Install::remove_roles();
27
28 // Tables.
29 EVF_Install::drop_tables();
30
31 // Pages.
32 wp_trash_post( get_option( 'evf_default_form_page_id' ) );
33
34 // Delete options.
35 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'evf\_%';" );
36
37 // Delete usermeta.
38 $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'evf\_%';" );
39
40 // Delete posts + data.
41 $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'everest_form' );" );
42 $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );
43
44 // Clear any cached data that has been removed.
45 wp_cache_flush();
46 }
47