This was recently discussed at length on the wp-hackers list. Here’s the thread:
Quoting Otto from the list:
The simplest method that would work
everywhere would be simply to store
the version number of the plugin
somewhere (like in your options entry
in the database), then compare the
stored version with your known
current and hardcoded version. When
you detect the difference, then that
means an upgrade has taken place, and
you can act accordingly. Another way
is simply to make the plugin detect
outdated options or older schemas and
upgrade them on-the-fly. This is
probably the most reliable, but it
does depend on what exactly you’re
upgrading. You can’t necessarily make
this “generic”.
Related Posts:
- WordPress Update Plugin Hook/Action? Since 3.9
- Update exisiting site to 3.5 release candidate
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- How to update an existing table while updating plugin?
- Can a plugin be used to contain all custom functions to extend other plugins
- How a deprecated function can crash WordPress site while upgrading
- Does WordPress run install/uninstall functions on plugin upgrade?
- Upgrade private plugin without deleting files?
- Plugin development: delete options when updating to a new version
- WP Plugin with Upgrade option
- dbdelta failing with error: “WordPress database error Table ‘wp_2_myPlugin’ already exists
- Rewrite not working since upgrade to 5.9
- Upgrade routine: Interaction with user confirmation
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Objective Best Practices for Plugin Development? [closed]
- add_menu_page() with different name for first submenu item
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- How to include PHP files in plugins the correct way
- How can I add an image upload field directly to a custom write panel?
- A tool to analyze rewrite rules? [closed]
- Difference Between Filter and Action Hooks?
- framework for plugin/theme options panel? [closed]
- Creating a table in the admin-style?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Settings API with arrays example
- How to get the path to the current theme?
- How to make a plugin require another plugin?
- ajaxurl not defined on front end
- What process do you use for WordPress development? [closed]
- What’s the difference between term_id and term_taxonomy_id
- Should I use wpdb prepare?
- Why does WordPress use outdated jQuery v1.12.4?
- Post meta vs separate database tables
- Is there any plugin development framework
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to add a javascript snippet to the footer that requires jQuery
- Enhance Media Manager for Gallery
- How do I create a custom role capability?
- How do I add CSS options to my plugin without using inline styles?
- How do i best handle custom plugin page actions?
- Adding Custom Text Patterns in the WP 4.5 Visual Editor
- Automatically determine minimum WordPress version required for a plugin?
- What is the advantage of using wp_mail?
- How to make a WordPress plugin translation ready?
- How many times will this code run? (or, how rich is grandma?)
- How to create an API for my plugin?
- Is it ever okay to include inline CSS in plugins?
- Plugins in symlinked directories?
- How to override existing plugin action with new action
- How to include a file using get_template_part() in a plugin?
- Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1
- How to store username and password to API in wordpress option DB?
- body_class hook for admin pages
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is it mandatory to use $wpdb->prefix in custom tables
- Which hook should be used to add an action containing a redirect?
- add_action hook for completely new post?
- Why does WordPress add 0 (zero) to an Ajax response?
- What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
- How to enqueue JavaScripts in a plugin
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Plugin Form Submission Best Practice
- How to redirect to settings page once the plugin is activated?
- Is get_option function cached?
- Should Plugin Folders Include a Blank index.php File?
- Unit testing for plugin development
- Methods of Integrating Plugin Data with Themes
- What is the wordpress wp-includes folder for?
- How to include jQuery and JavaScript files correctly?
- How come `wp_options` table does not have an index on `autoload`?
- PHP error with shortcode handler from a class
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- Best way to abort plugin in case of insufficient PHP version?
- WordPress Plugin Development – Headers Already Sent Message
- WP 3.3 How to Add Menu Items to the Admin Bar?
- dbDelta not creating tables
- Custom Widget function in Plugin not working?
- Passing arguments to a admin menu page callback?
- Single functions.php or split into many small files?
- Get page content using slug
- $_POST form request with admin-post
- How to fork a plugin?
- How can I configure Docker for developing and deploying a custom theme?
- How to include wp-load.php from any location?
- Correct way to enqueue jquery-ui
- Where to store PHP files created by plugin / themes
- How to echo the_excerpt without the P tag wrapper?
- How can I update a wordpress plugin from a Git repository (github)
- What are the advantages to the Settings API?
- Add screen options to custom admin pages
- Strategy On Building Plugin Using Eclipse
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Is There a Plugin Life Cycle Documentation?
- What do you think about custom designed plugin/theme options UIs?
- No Error Log File, no debug info
- Is it necessary to bump a plug-in’s version if you’re just updating the “Tested up to” attribute?
- Adding Widget form fields dynamically
- How to debug a plugin with Xdebug?
- WP_Query leaking absurd amounts of memory