query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'user_registration\_%';" ); $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'ur\_%';" ); $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'urmc\_%';" ); // Delete usermeta. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'user_registration\_%';" ); // Delete form id and confirm key. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ( 'ur_form_id', 'ur_confirm_email', 'ur_confirm_email_token' ) " ); $args = array( 'order' => 'ASC', 'numberposts' => -1, 'status' => 'publish', 'post_type' => 'user_registration', 'orderby' => 'ID', 'order' => 'DESC', 'no_found_rows' => true, 'nopaging' => true, ); $all_forms = get_posts( $args ); foreach ( $all_forms as $form ) { $result = wp_delete_post( $form->ID ); $del_meta = $wpdb->delete( $wpdb->postmeta, array( 'post_id' => $form->ID ) ); } // Clear any cached data that has been removed. wp_cache_flush(); }