Skip to content

'Remove all plugin data' setting not working without uninstall method #177

Open
@rvdsteege

Description

@rvdsteege

The core library adds a "Remove all plugin data on uninstall" setting on the settings page, even though the plugin might not actually hook register_uninstall_hook() or contain a uninstall.php file. When checked, users can expect the plugin data being removed on uninstall, while nothing will be removed if there are no uninstall methods implemented.

register_setting(
'pronamic_pay',
'pronamic_pay_uninstall_clear_data',
[
'type' => 'boolean',
'default' => false,
]
);

// Remove data on uninstall.
add_settings_field(
'pronamic_pay_uninstall_clear_data',
__( 'Remove Data', 'pronamic_ideal' ),
[ $this, 'input_checkbox' ],
'pronamic_pay',
'pronamic_pay_general',
[
'legend' => __( 'Remove Data', 'pronamic_ideal' ),
'description' => __( 'Remove all plugin data on uninstall', 'pronamic_ideal' ),
'label_for' => 'pronamic_pay_uninstall_clear_data',
'classes' => 'regular-text',
'type' => 'checkbox',
]
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions