Monday, July 4, 2022
HomeWordPress Developmentplugin improvement - Run uninstall.php if a checkbox is checked from settings...

plugin improvement – Run uninstall.php if a checkbox is checked from settings web page


I’m constructing a customized plugin and when the plugin is activated it creates 2 tables contained in the wp database. What I would like is, so as to add a checkbox is my customized plugin settings web page, and if the checkbox is checked, the tables to be deleted from the database. I’m utilizing and uninstall.php file to delete my tables however that occurs after I delete the plugin. I wish to hearth that uninstall.php file which have the scripts to delete my tables, if the checkbox is checked.

Right here is my code

<type motion="choices.php" methodology="POST" id="my-form">
<?php
    settings_fields("customfields");
    do_settings_sections("help");
    submit_button("Save Knowledge");
    ?>
</type>
<p>Delete Database? <?php echo get_option("delete_database"); ?></p>
<?php
add_settings_section("part", null, null, "help");
add_settings_field("wp_delete_database", "Delete Database?", array($this, "HTML"), "help", "part");
register_setting("customfields", "wp_delete_database", array("sanitize_callback" => "sanitize_text_field", "default" => "Placeholder"));
?>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments