[wp-testers] Plugin Loading Priority

Imthiaz Rafiq hmimthiaz at imthi.com
Fri Oct 20 21:08:21 GMT 2006


Hi Everyone

Let me introduce myself. I am Imthiaz from India currently working in Dubai,
United Arab Emirates. I have been using Wordpress for more than 2 years now
and I am a great fan. I have developed few plugins for Wordpress and I
really like it's architecture.

I have small suggestion regarding loading plugins. While activating a
plugins there is a sort function to sort the array of active plugins and
store the same in the settings.

if (!in_array($_GET['plugin'], $current)) {
	$current[] = trim( $_GET['plugin'] );
	sort($current);
	update_option('active_plugins', $current);
	include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
	do_action('activate_' . trim( $_GET['plugin'] ));
}

And while loading the file in wp-settings.php it is loaded in alphabetical
order.

if ( get_settings('active_plugins') ) {
	$current_plugins = get_settings('active_plugins');
	if ( is_array($current_plugins) ) {
		foreach ($current_plugins as $plugin) {
			if ('' != $plugin && file_exists(ABSPATH .
'wp-content/plugins/' . $plugin))
				include_once(ABSPATH . 'wp-content/plugins/'
. $plugin);
		}
	}
}

If we remove sort function from plugins activation page we can write a
plugins to sort the plugins array based on the order of loading. Even now it
is possible but if a new plugins is activated it will loose the order. If
the plugins sorter is integrated into the core it will be great.

Sometime some plugin create some issue due to other plugin. In these case we
can write filters hooks to communicate well between plugins if needed. This
is up to the plugin developers to do. 

I am not sure the above suggestion is of any meaning. I like to hear some
feedbacks. 

Thanks
Imthiaz
http://imthi.com/



More information about the wp-testers mailing list