<?php
/**
 * Uninstall — delete plugin data.
 */

if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    exit;
}

$options = array(
    'bw_feature_tour_trigger',
    'bw_feature_tour_show_to',
    'bw_feature_tour_primary_color',
    'bw_feature_tour_accent_color',
    'bw_feature_tour_allow_restart',
    'bw_feature_tour_animation_speed',
    'bw_feature_tour_overlay_opacity',
);
foreach ( $options as $opt ) {
    delete_option( $opt );
}

delete_metadata( 'user', 0, 'bw_feature_tour_completed', '', true );

$tours = get_posts( array(
    'post_type'      => 'bw_tour',
    'post_status'    => 'any',
    'posts_per_page' => -1,
    'fields'         => 'ids',
) );
foreach ( $tours as $id ) {
    wp_delete_post( $id, true );
}
