remove_cap( 'addifect_edit_design_files' ); } // Delete the custom Designer role. if ( get_role( 'addifect_designer' ) ) { remove_role( 'addifect_designer' ); } } addifect_uninstall_cleanup_roles(); /** * 3. Delete Options * These are the "definitions" of your site. */ $addifect_options = array( 'addifect_site_options', 'addifect_captured_assets', 'addifect_flush_on_next_render', ); foreach ( $addifect_options as $addifect_option ) { delete_option( $addifect_option ); } /** * 4. Delete All Tracked Transients (Manifest Cleanup) * Uses the stored index to avoid wildcard SQL deletes. */ $addifect_index = get_transient( 'addifect_site_templates_index' ); if ( is_array( $addifect_index ) && ! empty( $addifect_index['all_keys'] ) ) { foreach ( $addifect_index['all_keys'] as $addifect_template_id ) { // Sanitize the ID just to be safe during the loop. $addifect_clean_id = sanitize_key( $addifect_template_id ); delete_transient( 'addifect_site_template_' . $addifect_clean_id ); } } // Finally, delete the index itself. delete_transient( 'addifect_site_templates_index' ); /** * NOTE ON DATA RETENTION: * We do NOT delete entries from the wp_posts table. * If the user re-installs Addifect, their templates and * custom posts will re-appear automatically. */