monorepo/native/wordpress/learndash-start-button/uninstall.php

32 lines
No EOL
838 B
PHP

<?php
/**
* LearnDash Start Now Button - Uninstall
*
* Handles plugin cleanup when deleted through WordPress admin
*
* @package LearnDashStartButton
* @since 1.0.0
*/
// If uninstall not called from WordPress, exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
// Clean up options
delete_option('ldsb_version');
// Clean up any transients (if you add any in the future)
delete_transient('ldsb_courses_cache');
// Clean up user meta if any (currently none)
// delete_metadata('user', 0, 'ldsb_user_preference', '', true);
// Clean up post meta if any (currently none)
// delete_post_meta_by_key('_ldsb_button_override');
// Flush rewrite rules
flush_rewrite_rules();
// Note: We don't delete the block from posts as that could break content
// The blocks will gracefully degrade to showing nothing if plugin is removed