- @ Install MWP Framework
- @ General Updates
- @ Namespace Updates
- @ Hook/Filter Updates
- @ Behavioral Updates
- @ Structural Updates
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
withmwp-framework
@Namespace Updates
- Search and replace all instances of
Modern\Wordpress
withMWP\Framework
. - Search and replace all instances of
ModernWordpressFramework
withMWPFramework
. - Search and replace all instances of
@Wordpress
with@MWP\WordPress
.
@Hook/Filter Updates
- Search and replace all instances of
modern_wordpress_init
withmwp_framework_init
. - Search and replace all instances of
modern_wordpress_find_plugins
withmwp_framework_plugins
. - Search and replace all instances of
modern_wordpress_queue_run
withmwp_framework_queue_run
. - Search and replace all instances of
mwp_form_class
withmwp_fw_form_class
. - Search and replace all instances of
mwp_form_implementation
withmwp_fw_form_implementation
- Search and replace all instances of
mwp_tmpl
withmwp_fw_tmpl
. - Search and replace all instances of
modern_wordpress_queue_maintenance
withmwp_framework_queue_maintenance
.
@Behavioral Updates
- If any of your
Singleton
classes implement theinit
method, change the method name toconstructed
. - 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).