Documentation · Operations and Maintenance

Uninstall and Data Cleanup

This document describes what happens when the ADP Car Market Hub plugin is deactivated or uninstalled, what data is removed, what is retained, and how to control cleanup behavior. It also covers risks and recovery options.

When to use this document

Read this document before uninstalling the plugin from a production site. It is especially important if you want to preserve imported vehicle data, leads, or analytics after removing the plugin, or if you need to understand what will be deleted automatically.

Overview

The plugin's uninstall routine is executed when an administrator deletes the plugin through WordPress Admin → Plugins → Delete. The routine is defined in uninstall.php and runs in the context of the WordPress admin.

Simply deactivating the plugin does not delete any data. Data removal only occurs when the plugin is deleted (not just deactivated).

The uninstall routine distinguishes between:

  1. Items that are always removed — regardless of any setting
  2. Items that are conditionally removed — only if the Delete data on uninstall option is enabled
  3. Items that are never removed by the uninstall routine

What is always removed on uninstall

The following are always deleted when the plugin is removed, regardless of the Delete data on uninstall setting:

ItemDetails
All plugin optionsAll wp_options rows with as24ci_ prefixed keys, including API credentials, import settings, schedule configuration, design settings, lead form settings, and analytics settings
Database table: {prefix}as24ci_analyticsDropped unconditionally because it holds visitor tracking data and must not persist after the plugin is removed
Database table: {prefix}as24_vehiclesDropped unconditionally (vehicle field data used for display and search)
Database table: {prefix}as24ci_search_agentsDropped unconditionally because it holds personal data (subscriber name, email, search preferences)
Database table: {prefix}as24ci_content_studio_jobsDropped unconditionally (Content Studio AI content-generation job records)
Database table: {prefix}as24ci_content_studio_assetsDropped unconditionally (Content Studio generated marketing assets: captions, hashtags, alt text, image references)
Schema version optionsas24ci_vehicles_db_version, as24ci_search_agent_db_version and as24ci_content_studio_db_version are deleted alongside their tables
WP-Cron eventsas24ci_scheduled_import and as24ci_daily_cleanup are unscheduled
Transientsas24ci_access_token, as24ci_cron_import_running, as24ci_image_queue_running are deleted

These deletions cannot be undone. If you need to retain analytics data or vehicle field data, export it from the database before uninstalling.

What is conditionally removed on uninstall

The following items are only deleted if the Delete data on uninstall option (as24ci_delete_data_on_uninstall) is set to 1 (enabled):

ItemDetails
Vehicle posts (CPT: as24ci_car)All posts of the custom post type as24ci_car, in any status (published, draft, trash), are permanently deleted
Imported vehicle imagesAttachments tracked in the _as24ci_image_ids post meta for each vehicle post are permanently deleted from the WordPress media library
Featured imagesIf the vehicle post's featured image is an imported attachment, it is also deleted
Lead posts (CPT: as24ci_lead)All posts of the custom post type as24ci_lead are permanently deleted
Activation-created pagesThe archive page, compare page and favorites page created by the plugin on activation (IDs stored in as24ci_page_archive_id, as24ci_page_compare_id and as24ci_page_favorites_id) are permanently deleted

If this option is disabled (the default), all vehicle posts, images, and leads remain in the WordPress database and media library after the plugin is deleted. They will not be accessible through the plugin's admin UI, but the underlying WordPress data is preserved.

What is never removed

The following items are not deleted by the uninstall routine, regardless of settings:

ItemDetails
Manually uploaded gallery imagesAttachments tracked in _as24ci_manual_image_ids (images added manually through the WordPress media library, not imported from AutoScout24) are never deleted
WordPress user accountsAny users who were granted the manage_as24_imports capability retain that capability entry in the WordPress user meta
Log filesThe {uploads}/as24ci-logs/ directory and its contents are not deleted by the uninstall routine. Delete them manually via SFTP or the hosting file manager if needed
Cached data left in object cacheExternal object caches (such as Redis or Memcached) may retain plugin-related transient data until they expire naturally

How to control cleanup behavior

The Delete data on uninstall option is found in the plugin's Settings tab.

  1. Open ADP Car Market Hub → Settings.
  2. Find the Delete data on uninstall toggle or checkbox.
  3. Enable it if you want all imported vehicle posts, images, leads, and activation pages to be removed when the plugin is deleted.
  4. Leave it disabled (the default) if you want to preserve the imported content after the plugin is removed.

Recommendation: For a test or staging site where imported data can be discarded, enable this option before uninstalling. For a production site where the import history may be reused or audited, leave it disabled and manage content removal manually.

Multisite behavior

On WordPress multisite installations, the uninstall routine runs once per site in the network. For each site:

  1. If Delete data on uninstall is enabled, vehicle posts, images, leads, and activation pages are deleted for that site.
  2. The custom database tables (as24ci_analytics, as24_vehicles, as24ci_search_agents, as24ci_content_studio_jobs, as24ci_content_studio_assets) are dropped for that site (always).
  3. All plugin options for that site are deleted (always).

The multisite loop uses switch_to_blog() / restore_current_blog() to process each site independently.

Step-by-step: safe production uninstall

  1. Take a full backup of the database and uploads directory before proceeding. See Backup and Restore.
  2. If you want to preserve vehicle data, leave Delete data on uninstall disabled (the default). If you want a clean removal, enable it now.
  3. If you need to retain analytics data for reporting, export the {prefix}as24ci_analytics table from the database using phpMyAdmin, the WordPress CLI, or your hosting database tool before proceeding. This table is always dropped on uninstall.
  4. Navigate to WordPress Admin → Plugins.
  5. Deactivate the plugin first, then click Delete.
  6. Confirm the deletion prompt. The uninstall routine will run automatically.
  7. Verify the outcome: - Navigate to WordPress Admin → Tools → Database (or a database tool) and confirm that the custom tables are gone. - If Delete data on uninstall was enabled, verify that the vehicle archive page no longer exists. - If data was retained, confirm that the vehicle posts are still present in WordPress Admin → Posts or by visiting the archive URL directly.
  8. Delete the log directory manually via SFTP if it is no longer needed: {wp-content/uploads}/as24ci-logs/.

Operational notes and risks

  • The analytics table ({prefix}as24ci_analytics) is always dropped on uninstall without warning, even if Delete data on uninstall is disabled. If you have analytics data you want to keep, export it before deleting the plugin.
  • Similarly, the vehicles table ({prefix}as24_vehicles), search agents table ({prefix}as24ci_search_agents) and the two Content Studio tables ({prefix}as24ci_content_studio_jobs, {prefix}as24ci_content_studio_assets) are always dropped.
  • Imported images deleted by the uninstall routine are removed permanently from the server filesystem. They cannot be recovered from the WordPress media library.
  • If the get_sites() function is not available on a multisite installation, the uninstall routine falls back to single-site behavior and processes only the current site.
  • The option keys cleaned up on uninstall are derived from the Options class at runtime, so the list is always current with the installed plugin version. A fallback hard-coded list is used if the Options class cannot be loaded.
  • Deactivating the plugin without deleting it does not run the uninstall routine. No data is removed on deactivation. The plugin can be reactivated at any time and will resume normal operation.

Troubleshooting

SymptomLikely causeCheck
Vehicle posts still present after uninstallDelete data on uninstall was disabled (the default)Expected behavior; delete posts manually or re-enable the option and delete again
Analytics data missing after uninstallAnalytics table is always dropped on uninstallExport the table before deleting the plugin
Log files still present after uninstallLog files are not removed by the uninstall routineDelete the as24ci-logs/ directory manually via SFTP
Manually uploaded images deletedCheck that they were added via _as24ci_manual_image_ids, not imported via _as24ci_image_idsIf accidentally deleted, restore from a backup
Plugin options still present after uninstallUninstall routine did not complete (PHP error during deletion)Check the PHP error log; re-trigger by reinstalling and deleting again
Custom tables still present in databaseUninstall routine encountered a database permission errorRun DROP TABLE IF EXISTS {prefix}as24ci_analytics manually