1. Home
  2. Docs
  3. Application Framework
  4. Extras
  5. Upgrade 1.x to 2.x Guide

Upgrade 1.x to 2.x Guide

The 2.x version of the ‘MWP Application Framework’ includes some significant changes over the 1.x branch of ‘Modern WordPress’, and has been overhauled with new namespaces and a rebranding. It has also moved to a new repository.

https://github.com/codefarma/mwp-framework.

Care has been taken to allow it to run side by side with plugins still using the 1.x version, however, it is highly recommended to update all plugins to use the 2.x MWP Framework since all new features and improvements are being developed against the 2.x release.

For a list of all of the changes to the 2.x version, see the changelog.

@Install MWP Framework

To upgrade a plugin from the 1.x to 2.x framework, first install the new framework to your development environment, or clone it to be able to pull the latest changes using your git client.

The following updates then need to be applied to the plugin which you are attempting to upgrade:

@General Updates

  • The Depends header in your main plugin file (if it exists) can be removed.
  • Search and replace all instances of modern-framework with mwp-framework

@Namespace Updates

  • Search and replace all instances of Modern\Wordpress with MWP\Framework.
  • Search and replace all instances of ModernWordpressFramework with MWPFramework.
  • Search and replace all instances of @Wordpress with @MWP\WordPress.

@Hook/Filter Updates

  • Search and replace all instances of modern_wordpress_init with mwp_framework_init.
  • Search and replace all instances of modern_wordpress_find_plugins with mwp_framework_plugins.
  • Search and replace all instances of modern_wordpress_queue_run with mwp_framework_queue_run.
  • Search and replace all instances of mwp_form_class with mwp_fw_form_class.
  • Search and replace all instances of mwp_form_implementation with mwp_fw_form_implementation
  • Search and replace all instances of mwp_tmpl with mwp_fw_tmpl.
  • Search and replace all instances of modern_wordpress_queue_maintenance with mwp_framework_queue_maintenance.

@Behavioral Updates

  • If any of your Singleton classes implement the init method, change the method name to constructed.
  • If you are using the previous implementation of the form builder in your plugin, the form will need to be refactored according to the new form builder implementation.
  • The new framework is now initialized during the after_setup_theme hook in WordPress, so any actions before that which you need to hook into cannot be done with an annotation.

@Structural Updates

  • If any theme customizations include overrides for templates in your upgraded plugin, they will need to be relocated to a /templates subdirectory of the override folder they are currently in (which is the mwp plugin slug).
Was this article helpful to you? Yes No

How can we help?