سؤال

There are plenty of articles which explain how to create a wordpress plugin. I'm not looking for that, I'm looking for a schema of the core architecture of a wordpress plugin (an UML class diagram and sequence for example).

Has somebody seen anything like that somewhere ?

Update: I know plugin can be as simple as a function. It's not my question. My question is about the architecture of the CALLER that calls the plugin, that is the architecture of the SYSTEM pertaining to the call of the plugin.

At least in which PHP module(s) is it implemented by the Wordpress Core System files ?

هل كانت مفيدة؟

المحلول

There is not much to it, really.

  1. During the loading of WordPress engine wp-settings.php file is processed.

  2. Among other things this files calls wp_get_active_and_valid_plugins() function, that gets list of activated (through admin interface) plugins from active_plugins option (stored in database).

  3. For each active plugin its main file (the one holding plugin header) is included and from there it is up to plugin how it uses Plugins API (more commonly known as hooks) to integrate with WordPress.

Basically it is only a thin layer of active/inactive controls on top of straight PHP include.

نصائح أخرى

The WP plugin architecture is event based and is very simple:

Events are attached using add_action() and add_filter().

Events are triggered using do_action() and apply_filters().

All these functions are found in wp-includes/plugin.php

More information can be found here: http://codex.wordpress.org/Plugin_API

For a "flow diagram" of sorts, see this site: http://wp-roadmap.com/demo/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى wordpress.stackexchange
scroll top