Documentation · Technical Documentation
Uninstall And Cleanup Behavior
This document explains exactly what happens when the ADP Car Market Hub plugin is deleted from a WordPress site, including which data is always removed, which data is only removed when the opt-in cleanup flag is enabled, and how multisite installations are handled.
When to use this document
Read this document if you need to:
- Plan a clean removal of the plugin from a production site.
- Understand whether deleting the plugin will keep or destroy imported vehicles, leads or settings.
- Audit GDPR / data-protection compliance for plugin removal.
- Migrate a site to another plugin and need to know what is left behind.
Overview
The plugin ships with an uninstall.php script that WordPress
runs automatically when the plugin is deleted from
Plugins → Installed Plugins. The script:
- Always removes plugin transients and unschedules the plugin's WP-Cron events.
- Always drops the plugin's custom database tables, including those holding visitor or personal data.
- Optionally removes plugin-created posts (vehicles, leads, imported attachments, plugin-created pages) when the Delete data on uninstall setting is enabled.
- Always removes the full set of plugin options.
The intent is privacy-first by default: any data the plugin collects about visitors (analytics events, search-agent subscriptions) is removed unconditionally, while content authored on top of imported data (which a customer may want to keep even after uninstalling the importer) is only removed when the customer explicitly opts in.
What is always removed
Regardless of the Delete data on uninstall setting, the uninstall routine performs the following:
- Transients:
as24ci_access_token— cached AutoScout24 access token.as24ci_cron_import_running— import run lock.as24ci_image_queue_running— image-queue worker lock.- WP-Cron events:
as24ci_scheduled_import— main scheduled import.as24ci_daily_cleanup— analytics retention cleanup.- Custom tables:
<prefix>as24ci_analytics— visitor tracking events.<prefix>as24_vehicles— vehicle field data table.<prefix>as24ci_search_agents— saved-search subscriptions (contains email addresses and search criteria).<prefix>as24ci_content_studio_assets— Content Studio assets.<prefix>as24ci_content_studio_jobs— Content Studio jobs.- Schema-version options:
as24ci_vehicles_db_version.as24ci_search_agent_db_version.as24ci_content_studio_db_version.- Plugin options: every key declared by
AS24CI\Options::get_all_keys(), plus a small set of non-constant keys appended explicitly:as24ci_models_cache_keys,as24ci_page_archive_id,as24ci_page_compare_id,as24ci_page_favorites_id, the legacyas24ci_api_total_cache, and the Content Studio settings (as24ci_content_studio_db_version,as24ci_content_studio_google_api_key,as24ci_content_studio_default_language,as24ci_content_studio_default_tone,as24ci_content_studio_brand_voice,as24ci_content_studio_disclaimer_text,as24ci_content_studio_compliance_notes).
What is removed only when opt-in is enabled
The setting as24ci_delete_data_on_uninstall controls
destructive cleanup of plugin-created content. When it equals
1, the uninstall routine additionally:
- Iterates all
as24ci_carposts (any status) and: - Deletes attachments listed in
_as24ci_image_ids(imported images). - Deletes the post's featured image attachment when present.
- Deletes the vehicle post itself with
wp_delete_post( $id, true ). - Deletes all
as24ci_leadposts. - Deletes activation-created pages whose IDs are stored in
as24ci_page_archive_id,as24ci_page_compare_idandas24ci_page_favorites_id.
Manual gallery attachments (referenced from
_as24ci_manual_image_ids) are intentionally not deleted.
This protects images that a customer added by hand, even if the
parent vehicle post is removed.
Multisite handling
On a network installation:
- The script iterates every site returned by
get_sites(). - For each site, it
switch_to_blog(), runs the destructive cleanup (when opted in), drops the per-site analytics, vehicles, search-agent and Content Studio (jobs + assets) tables, removes per-site options andrestore_current_blog(). - After processing every site, the function returns and does not run the single-site branch.
Verify the multisite path against your network's role configuration before bulk-uninstalling in production; the script does not perform any cross-site cascading beyond the operations listed above.
Step by step instructions
Remove the plugin and keep all imported content
- (Optional) Open the plugin's settings and confirm Delete data on uninstall is off.
- Go to Plugins → Installed Plugins, deactivate "ADP Car Market Hub", then click Delete.
- Confirm the deletion. WordPress executes
uninstall.php. Imported vehicle posts and their images remain in the database; plugin settings and visitor data are removed.
Remove the plugin and all plugin-created content
- Open the plugin's settings.
- Enable Delete data on uninstall.
- Save.
- Go to Plugins → Installed Plugins, deactivate the plugin, then click Delete.
- Confirm. WordPress runs
uninstall.php, which removes imported vehicles, imported attachments, leads and the plugin-created archive/compare/favorites pages.
Configuration reference
| Option key | Effect |
|---|---|
as24ci_delete_data_on_uninstall | When 1, also removes imported posts, imported attachments, lead posts and plugin-created pages on uninstall. Default 0. |
For the full list of plugin options, see Options And Settings Storage.
Operational notes
- Uninstall runs in a special WordPress context with limited
bootstrap. The script avoids loading heavy dependencies and
is defensive about missing classes (a hard-coded option list
is used as a fallback if
AS24CI\Optionscannot be loaded). - Custom-table drops are issued with raw
DROP TABLE IF EXISTSon the prefixed table name. Hosts that restrict schema-changing privileges may produce warnings here; the drop is best-effort and does not abort the uninstall. - Imported images that are referenced by other posts (for example reused as featured images in unrelated content) will still be removed when the opt-in cleanup is enabled. Audit reuse of imported attachments before opting in.
- Manual gallery images stay in the WordPress media library even when the opt-in cleanup is enabled; remove them separately if required.
- Webhook URLs and shared secrets are stored in plugin options and therefore removed unconditionally on uninstall. External systems will stop receiving events as soon as the plugin is deleted.
- Deactivation alone (without deletion) does not run
uninstall.php. It only clears pending WP-Cron events and refreshes rewrite rules.
Troubleshooting
- Imported vehicles remain after uninstall — *Delete data
on uninstall* was off when the plugin was deleted. Restore
the plugin temporarily to obtain the admin UI, enable the
toggle, then delete again. Alternatively, remove
as24ci_carposts manually with WP-CLI. - Custom tables still exist after uninstall — the database
user lacks
DROPprivileges. Drop the tables manually with a privileged account. - Multisite uninstall left some sites with data — confirm the network admin executed the deletion. Per-site uninstalls triggered by site administrators do not always cascade across the network depending on the WordPress version. Verify the current behaviour against your WordPress release before large rollouts.
- Plugin options reappear after reinstall — they were re-created by activation. Cleanup runs only on delete, not on deactivate.