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?
- Get a path to a different plugin
- How to check uniqueness of plugin prefix?
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- Change default admin page for specific role(s)
- Check for dependent plugin and if false dont activate plugin
- How to check username/password without signing in the user
- Show message on wordpress admin dashboard
- Log in from one wordpress website to another wordpress website
- What’s the earliest point I can get the queried object ID?
- Custom admin_notices Messages Ignored During Redirects
- Add content to widget title in admin area within the widget?
- How is the data stored in the database?
- Is it save to require plugin.php early to be able to use get_plugin_data() earlier?
- When is it appropriate to put functions on page template vs. functions.php?
- How to prevent loading of all plugin’s resources?
- Unit Testing a Plugin functionality with cron
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- Is it possible for a plugin to register a page template file?
- Best way for plugin to accept POSTs?
- What are the really difference writing WordPress 3.x widget plugins?
- Error “Call to a member function switch_to_locale() on null” during insert_with_markers
- multiple functions with same filter
- Calling plugins API within a theme
- How do you output enqueued scripts to an admin page?
- Woocommerce – Hide a Column in Cart Table
- Does WordPress’s HTTP API use any caching?
- query users by role
- Enqueue scripts in footer
- Is It Always a Best Practice to Decouple the Frontend from the Admin Area When Developing a WordPress Application?
- the_editor() function
- Including the necessary functions for a custom ajax registration form
- Why doesn’t my simple the_title filter get applied?
- WordPress clean internationalization for menus?
- Dashboard – get status and position of metaboxes and pass them to ajax method
- Is it possible to install a theme via a plugin?
- JSX in WordPress Plugin Development
- W3 Total Cache JS and css Minify folder are empty
- Form doesnt save to database
- Including comments meta box on a plugin page
- TinyMCE editor turns white on Biographical info [closed]
- How I can use order by of the custom post title?
- How to create custom settings page for custom plugin
- Why wp_die() doesn’t work with wp_redirect but exit() works
- Internationalizing Plugin
- Update File Once Every 30 Days
- Taxonomies within plugin invalid
- Make Database query only when option is updated
- Use npm and wp-env to make production bundle
- Looking for a better way to initiate cron job
- shortcode executed in the page editor
- Plugin header: WP and PHP version control uses wp_die(), can I change that?
- Form using admin-post.php gives 404 after submission
- per blog metadata for plugin
- Completely isolate a plugin view so it doesn’t load the theme
- How to use gettext for specific user role
- Custom Post Type Object – Undefined Variables
- How to translate wordpress backend to another language
- How does “Your comment is awaiting moderation” work?
- How to link to custom “archive like” page with custom permalink rules “dynamically”
- rewrite_rules problem
- Dynamic page generation upon purchase of a product
- Custom post type change permalink query
- Upload product image from frontside for administrator only
- Settings API not saving
- Allowing duplicating users with same user_login and user_email
- Why does theme’s reset CSS have higher precedence of plugin’s CSS?
- Updating the_post content is only working with Twenty Twenty theme
- Redirect WooCommerce checkout to cart
- Scripts/styles not loading on cloned WP Site when logged in
- Initializing rest endpoint issue
- WordPress plugin how to run function when button is clicked
- Save in my custom admin page and redirect to the saved object
- How to display archive by selecting year and then selecting month
- What is more secure checking capabilities of user or checking role of user in WordPress plugin development
- Undefined notice on unset field
- Theming Custom Plugin Page
- From my Plugin Settings Page use check boxes to load specific css files (e.g. Bootstrap / Foundation)
- Script work on non logged in user but not work for logged in user?
- admin page passing $_POST variables to itself
- Can wp_schedule_single_event be used to run background proccess?
- Nothing happens on WordPress Update command
- Get user logged in status from within a plugin. $current_user not defined
- Widget plugin and input file
- How to inject html to every page with a plugin?
- Add a custom image source
- Plugin forms overwrite each other’s options