$config ) { $post_type = CPT::post_type_slug( $slug ); $post_ids = get_posts( array( 'post_type' => $post_type, 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', ) ); foreach ( $post_ids as $post_id ) { wp_delete_post( $post_id, true ); // skip Trash, delete outright } // Taxonomy isn't registered yet (init hook never ran) — bare // registration is enough for get_terms()/wp_delete_term() to work. $taxonomy = CPT::taxonomy_slug( $slug ); register_taxonomy( $taxonomy, $post_type ); $term_ids = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => false, 'fields' => 'ids', ) ); if ( ! is_wp_error( $term_ids ) ) { foreach ( $term_ids as $term_id ) { wp_delete_term( $term_id, $taxonomy ); } } } } delete_option( Map_Types::OPTION ); delete_option( Settings::OPTION_TOKEN ); delete_option( Settings::OPTION_STYLE ); // Legacy global "3D buildings" option, superseded by a per-map default; may still exist on old installs. delete_option( 'mapfield_spots_3d_buildings' ); // Dark mode/backup options are PRO's own (mapfield-spots-pro/uninstall.php clears // them) — this plugin can't be deleted while PRO still requires it, so that // uninstall always runs first. // Both self-delete on first use; cleaned up here for the edge case where that never fired. delete_option( 'mapfield_spots_activation_redirect' ); delete_option( 'mapfield_spots_flush_rewrite' ); // Map_Types_Admin::DISMISSED_ACF_ORPHANS_OPTION / Frontend's own rewrite-flush flag. delete_option( 'mapfield_spots_dismissed_acf_orphans' ); delete_option( 'mapfield_spots_preview_rewrite_added' ); } )();