Working for couple of Months with WordPress and developing basic plugins I have the impression that wordpress is not able to handle properly requests if more plugins are activated and mainly because that all of theme are reachable inside of the hole framework. Is there a way to setup the plugins in such a way that each plugin should be called when it needs to be called?
Leave a Reply
You must be logged in to post a comment.
To run a plugin only when it is needed the plugin author has to identify the pages where the code actually does something.
WordPress offers a surprisingly simple way to do that: the global variable
$pagenow
.It is set before a plugin is called in
wp-includes/vars.php
.In a spam block plugin I have written recently I needed my plugin to run on four pages only:
wp-comments-post.php
to filter the posted commentswp-admin/plugins.php
to add a link in the plugin row to the settingswp-admin/options-discussion.php
to show two option fieldswp-admin/options.php
to save the option fieldsSo I added a helper method to my plugin controller â¦
⦠and check that method before I do anything else in my plugin:
And if my plugin is called it does only what is really needed, nothing else:
As a framework WordPress offers the tools to specialize each part of the plugin code. But it is up to the authors to use these tools, and many authors fail here.