Sure, there are activation and deactivation hooks. See: https://developer.wordpress.org/plugins/plugin-basics/activation-deactivation-hooks/
<?php
register_deactivation_hook( __FILE__, 'wpse_deactivate_myplugin' );
function wpse_deactivate_myplugin() {
// Delete the file and do any other cleanup needed here.
}
Related Posts:
- What Features would you Most Like to See Added to WordPress? [closed]
- Update my custom WordPress Plugin through my own server [duplicate]
- How to automatically install default WordPress plugins?
- Shared functionality in plugins and themes
- How to get the main blog’s id and db prefix from a mu plugin?
- Allowing Yoast SEO plugin to track me
- How to read configuration file in wordpress or PHP
- How to filter all products by products_tag (woocommerce )
- Members Only site with Feed Keys
- Please select a file error
- Should I install plugins to my WordPress installation from web sites having in URL “nulled” or, “null”?
- WP-PageNavi plugin doesn’t work with multiple pages of search results
- Adding rich text editor to my plugin
- How to get Plugin Slugs?
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- How do I add advanced custom fields / meta fields to Elasticsearch? [closed]
- Loading class files via autoload method
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- Change the $parent_file of a plugin page
- Plugin to book course and pay online for it
- How to set a custom title per language?
- Exclude plugins on Main site on Multisite installation?
- Escape when echoed
- WP_Query ordering numbers as letters
- Execute a plugin only on post pages
- JQuery not working in my plugin [closed]
- Lightbox Plus ColorBox plugin and auto playing YouTube video
- Can’t send mails using contact plugin [closed]
- Bulk edit existing shortcode within custom field
- Create dynamic page content from custom WordPress plugin page
- WooCommerce Custom Product to checkout
- How to stop or remove an action being called inside a function of an extended class
- How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?
- Default WordPress WP Editor removing style tags and html tag
- How to debug error message: Cannot modify header information
- Adding a new field to the address field type in gravity forms
- Show admin notice on incorrect value on form field
- Removing included CSS file that doesn’t exist
- Visual Composer shortcode for child theme dir
- Is W3 Total Cache supposed to delete the local files after they are uploaded to CDN? [closed]
- How to use my menu PHP code as sidebar?
- Change plugin name on WordPress repo
- Using wpdb without loading all plug-ins via wp-load.php
- Are plugins instantiated on every request to WordPress?
- Why shortcode always displayed after footer not in body
- adding a button to the media uploader
- Get path to themes CSS file inside of a Plugin
- how to activate a plugin inside a theme
- Add some fileds to the wp_posts table
- How do I add $_SESSION[”] to my wordpress page?
- There has been a critical error on your website – won’t fix no matter what
- Get orders of a specific customer woocommerce
- What am is missing? (API CORS)
- How to find out which plugin create captcha after login?
- All in One SEO Pack error message
- How to fix broken media library?
- Deactivated Visual Composer plugin, site crashed, what to do? [closed]
- JQuery needs to be defined in , but Gravity Forms is defining it in the
- Plugin hook not working on specific WordPress installation – how to troubleshoot?
- Add Stack Exchange Recent Questions to a wordpress sidebar?
- How to hide plugin options for editors via functions.php
- Installed WordPress.com Stats with api key and forgot key. How can I register w/ new key?
- Shopp Plugin Remove Quantity Dropdown [closed]
- jQuery slider widget similar to cnet.com
- In Multisite Setups, how to update mass sections of sub-sites
- Using file_get_contents within admin but keep logged in
- need to find duplicated meta value in custom filed and view the posts that have the same value
- Woocommerce plugin – How to create two versions of the same plugin with slightly different implementation for different users
- Push Contact form 7 variable to front end after submission
- Add a parameter at the end of the url and prettify
- Is there any known plugins that would replace WordPress classes in editor with their Bootstrap 4 equivalent?
- Add spacebar in WP List Table Search
- Error after installing the WordPress plugin updates
- Plugin to manage form submissions on admin panel
- Configuring default woo commerce login with modal popup
- How to iterate on a list?
- Is there a plugin to merge several drafts into a new post?
- URL Case Sensitivity (Unbounce Landing Pages)
- The etiquette of forking a plugin and table tag
- echo plugin results on pages
- How can I remove this sidebar from my Search Results page?
- How to pass value to a plugins shortcode?
- Confusing problem with displaying message recipient metadata
- When in WordPress I try to run a php script directly I am redirected to the home page
- How do I replace the e-mail form to functional e-mail subscription? [closed]
- installed WordPress but can’t upgrade or add plugins due to webdav https?
- Display WP Start bar on front page only
- Plugin (smart archives reloaded) crashed site / no access on admin panel
- Can’t pull metadata for a term in my theme’s function.php
- I used a plugin that hides wp-admin, but it hid wp-admin for admin too – how to revert back?
- How to use Link Manager
- How to make my plugin insert text into a custom div?
- Submit posts in two different post types with the same form
- Static page with formatted post list
- Preset categories in wordpress by GET-paremters [duplicate]
- Render CMB2 select option to post page [closed]
- How can JavaScript code be added before the closing HTML body tag?
- Ajax response from Media Selection does not update ALL information more than once
- PHP Deprecated function Optional parameter $function