reset-plugin-data
File: bin/reset-plugin-data.php
Wipes every database entry and generated file created by the plugin. Use this to get back to a clean slate between blueprint tests, demo installs, or development iterations.
Usage
Run from the WordPress root directory:
wp eval-file wp-content/plugins/sanil-website-builder/bin/reset-plugin-data.php
No arguments. The script always wipes everything.
What It Deletes
1. Custom Templates Table
Target: {prefix}sanilwb_templates
All template rows are removed via TRUNCATE. This resets the auto-increment counter as well, so the next inserted template will start from ID 1 again.
2. Plugin Options
Target: wp_options where option_name LIKE 'sanilwb_%'
Every option the plugin writes uses the sanilwb_ prefix, so a single DELETE ... LIKE query catches all of them. This includes:
| Option | Written by |
|---|---|
sanilwb_header_preset |
Header & Footer — active header preset slug |
sanilwb_header_preset_settings |
Header & Footer — slot values for the active header |
sanilwb_footer_preset |
Header & Footer — active footer preset slug |
sanilwb_footer_preset_settings |
Header & Footer — slot values for the active footer |
sanilwb_{type}_preset |
Header & Footer — active preset for single/page/archive/404/search |
sanilwb_{type}_preset_settings |
Header & Footer — slot values for single/page/archive/404/search |
sanilwb_layout_assignment_{type} |
Site Layout CPT — active Site Layout post ID for single/page/archive/404/search |
sanilwb_theme_options |
Theme Options — colors, typography, logo, social |
sanilwb_active_fonts |
Font Sync — list of fonts in use |
sanilwb_fonts_css_version |
Font Downloader — hash of the last-downloaded font CSS |
sanilwb_fallback_font_url |
Font Downloader — Google Fonts URL used as fallback |
sanilwb_blueprint_snapshot |
Blueprints — snapshot taken before last install |
sanilwb_blueprint_ref_map |
Blueprints — post ID mapping during install |
sanilwb_blueprint_install_status |
Blueprints — in_progress or completed |
sanilwb_blueprint_last_name |
Blueprints — name of the last applied blueprint |
sanilwb_blueprint_last_applied |
Blueprints — slug of the last applied blueprint |
sanilwb_template_assignment_{type} |
Legacy — template assignment per post type |
3. Page Builder Post Meta
Target: wp_postmeta where meta_key = 'sanilwb_data'
Removes the page builder layout JSON from every post and page that had the builder applied. The posts themselves are not deleted — only the sanilwb_data meta key is removed.
4. Compiled Template Files
Target: wp-content/sanilwb-templates/
The entire directory is deleted recursively. This directory contains:
template-{id}.php— compiled PHP render filestemplate-{id}.css— compiled CSS filespreview-{id}.jpg— template preview screenshots
5. Downloaded Font Files
Target: wp-content/uploads/sanilwb-fonts/
The entire directory is deleted recursively. This directory is created by the Font Downloader when Google Fonts are self-hosted. It contains the font CSS file and all downloaded font face files (.woff2, .woff, etc.).
What It Does NOT Delete
| Item | Reason |
|---|---|
| Posts and pages created by Blueprints | No persistent post marker is stored after the install finishes |
Site Layout CPT entries (sanilwb_site_layout posts) and their sanilwb_layout_type meta |
Same reasoning as Blueprint posts — this script clears the sanilwb_data meta key (the layout content) and the sanilwb_layout_assignment_{type} options (the active assignment), but does not delete the entry posts themselves |
| WordPress core options modified by Blueprints | show_on_front, page_on_front, sidebars_widgets, widget_block, widget_text — these belong to WP core and could affect other functionality |
The wp_sanilwb_templates table structure |
Only rows are removed; the table schema is preserved |
If you need to also reset the WordPress reading settings and widget areas, do that manually via the WordPress admin or with additional wp option update calls.
Example Output
Truncated table: wp_sanilwb_templates
Deleted options: 14 rows (option_name LIKE 'sanilwb_%')
Deleted post meta: 3 rows (meta_key = 'sanilwb_data')
Deleted directory: /var/www/html/wp-content/sanilwb-templates
Deleted directory: /var/www/html/wp-content/uploads/sanilwb-fonts
Done. All plugin data has been wiped.
Implementation Notes
- Uses
TRUNCATE(notDELETE) on the templates table — faster and resets auto-increment. - Uses a
LIKE 'sanilwb_%'query onwp_options— catches all current and future plugin options without needing to list them individually. - Directory deletion uses PHP's
RecursiveDirectoryIteratorinCHILD_FIRSTorder, which ensures files are deleted before their parent directories. - The script is safe to run even when directories don't exist — it checks with
is_dir()before attempting deletion and prints a "skipped" message instead of erroring.