prefix; $statement = 'DELETE from ' . $table_prefix . 'options WHERE option_name like %s'; $settings = "aalb%"; $prepared_statement = $wpdb->prepare( $statement, $settings ); $wpdb->query( $prepared_statement ); } catch ( Exception $e ) { error_log( 'Unable to clear settings. Query failed with the Exception ' . $e->getMessage() ); } } function aalb_create_dir( $dir_path ) { if ( ! wp_mkdir_p( $dir_path ) ) { error_log( "Error Creating Dir " . $dir_path . ". Please set the folder permissions correctly." ); return false; } return true; } /** * Recursively remove the template uploads dir * * @since 1.8.0 */ function aalb_remove_uploads_dir() { require_once( ABSPATH . 'wp-admin/includes/file.php' ); try { WP_Filesystem(); global $wp_filesystem; $upload_dir = wp_upload_dir(); $upload_dir = $wp_filesystem->find_folder( $upload_dir['basedir'] ); $template_upload_path = $upload_dir . AALB_TEMPLATE_UPLOADS_FOLDER; if ( ! $wp_filesystem->is_dir( $template_upload_path ) && ! aalb_create_dir( $template_upload_path ) ) { return false; } $wp_filesystem->rmdir( $template_upload_path, true ); } catch (Exception $e) { error_log( 'Unable to remove templates uploads directory. Failed with the Exception ' . $e->getMessage() ); } } aalb_remove_settings(); aalb_remove_uploads_dir();