WPMasterToolKit has been designed with an innovative approach: load only what you need. This philosophy guarantees optimal performance for your WordPress site. Find out how our intelligent module loading system works and why it can make all the difference to your projects.
Why limit module loading?
In many WordPress plugins, all modules are loaded as soon as the plugin is activated, whether or not they are used. This can lead to unnecessary overloading, slowing down the site and consuming server resources.
With WPMasterToolKit, every inactive module remains dormant. The result: reduced loading times and improved user experience.
Thoughtful architecture
The module loading system is based on a central class: WPMastertoolkit_Handle_options
. This class manages module activation according to the options defined in your database. Here's how it works:
1. Detection of active modules
The process starts with the instantiate_active_options
which checks the options stored in the database using get_option
. Each active option is marked with a status ('1'
).
$db_options = get_option( WPMASTERTOOLKIT_PLUGIN_SETTINGS, array() );
2. Conditional module loading
Once the active modules have been identified, their paths are reconstructed:
$option_path = WPMASTERTOOLKIT_PLUGIN_PATH . admin/modules/' . $option_path;
If the corresponding file exists, it is loaded dynamically via require_once
and the associated class is instantiated only if it exists :
if ( is_file( $option_path ) && class_exists( $option_key ) ) {
new $option_key;
}
3. Custom module management
For modules requiring specific configuration, another method is used, instantiate_custom_options
comes into play. It allows non-standard modules to be added to the management system.
$custom_options = array(
'WPMastertoolkit_Nginx_Code_Snippets' => 'core/class-nginx-code-snippets.php'
);
This flexibility ensures that each module can be integrated cleanly and efficiently.
A lightweight, high-performance system
Unlike global loading, WPMasterToolKit applies a simple principle: one module activated = one module loaded. This system saves resources and improves performance, particularly on shared hosting or high-traffic sites.
Advantages of this approach :
- Performance Less busy classes = better response time.
- Modularity Easy management for adding or removing modules.
- Simplicity : Each module is independent, which reduces potential conflicts.
Conclusion: modular management for the future
With WPMasterToolKit, we've rethought the way WordPress plugins work. Our intelligent loading system ensures that you never sacrifice performance for functionality. Whether you're a developer or an end user, this approach means you'll enjoy a fast, reliable site.
Test WPMasterToolKit and see the difference for yourself!