Home  ›  Troubleshooting  ›  Plugin Conflicts

Plugin Conflicts

One of the major strengths of WordPress is the way it can be extended with plugins. But this same strength can also cause total chaos when a conflict arises and sooner or later conflicts will arise. With every additional plugin activated, the potential for problems grows exponentially and they can be very hard to trace.

Added to this, every person using WordPress as their platform will have a completely different set of plugins – and when the number of users and the number of available plugins are taken into account the permutations run into the millions. And just for good measure – there are also many hundreds of themes!

By far the largest volume of support queries raised on the Simple:Press Support Forum come down to problems with plugin and theme co-habitation. The main issues are described below.

JavaScript Conflicts

The most common conflicts are caused by the use of JavaScript. This is no surprise as JavaScript is a complex programmng language that can be hard to debug and is becoming more prevalent as users demand richer user interfaces. Like WordPress itself, Simple:Press Forum utilises a lot of JavaScript and while we will not claim our code is perfect, we do attempt at all times to abide by the structure that WordPress gives us. The main reasons conflicts arise are given below.

The best way to track down JavaScript conflicts is to use Firefox with the Firebug extension installed – but the Firefox Error Console can also help. See the section below on ‘Finding Your Errors’.

Too Much of a Good Thing!
It is an obvious fact that the more JavaScript being used the greater the risk of problems. With every addition of a new script being loaded the possibility grows that something is going to fall over and come crashing down. We urge users to examine what plugins they have active on a regular basis, cutting out those they do not really need.

Rules? Aren’t they just Guidelines?
Not abiding by the architecture that WordPress gives to plugin authors is probably the most common cause of conflict. There are strict rules on the correct way to use and load JavaScript programs and if these rules are ignored – which they so often are – the result can be that code libraries, like jQuery or Prototype, get loaded more than once. Indeed whilst helping users with problems we have seen some libraries loaded as many as four times – often utilising a variety of different versions. Not only is this a collapse waiting to happen but it is also slowng down the website.

Am I Needed Here?
JavaScript should only be loaded where needed. When on a forum page, you do not need that snazzy AJAX blog comment routine so the code should not be loaded. Sadly, a lot of plugin authors do not take that extra step to ensure their code is only made available when strictly necessary to the resultant detriment of your website and the increased possibility of a conflict.

Where Did You Come From Then?
We have often seen JavaScript being loaded and used in plugins that was not written specifically for WordPress but has been imported from elsewhere. There can be nothing wrong with this if the code is generic but authors sometimes fail to remove or modify the parts that are not needed leading to the inevitable error condition which can often stop all other scripts from being run.

Simple:Press Forum only loads it’s JavaScript where it is needed and only loads scripts required for the current page. It also plugs correctly into the WordPress architecture.

Tracking Down JavaScript Problems

Firefox with the Firebug Extension installed is still probably the best tool for hunting down a script problem. Just having it installed and visiting a variety of websites – including leading commercial sites – can be quite an eye opener as it displays errors down in the browsers status bar.

If your site starts to misbehave – whether in Simple:Press Forum or not – this is a good tool for determining whether the problem is script related and if that is the case and the culprit script determined, then the offending plugin can easily be deactivated to see if the problem disappears. But remember that a problem in one script can cause issues in another. For example, some jQuery errors can stop jQuery processing any more script which can make the culprit hard to find.

At the end of the day, the best course of action is to deactivate all plugins and then reactivate them one at a time – clearing the browser cache between each one – until the problem resurfaces having identified the plugin with the problem.

PHP Conflicts

PHP conflicts are more rare but can occur. Most php conflicts will usually come about because a plugin loads too much of it’s code at all times instead of as and when it is needed. The way WordPress works dictates that some code from each installed plugin is loaded every time a page of your site is accessed. This can not be worked around. But a well written plugin will ensure that this code is kept to a minimum unless the page being viewed needs the whole plugin code. In most respects this is similar to the points already discussed in the JavaScript section.

Most conflicts may arise using the WordPress Filter and Action hooks. These are the methods that WordPress uses to allow plugins to integrate, use core code and make changes and additions to the standard application. Filter and Action hooks are very powerful but problems can arise when more than one plugin makes use of the same hook to run some code. Mostly this is fine but every now and then the two actions may conflict with each other.

A good example of this would be the filter known as ‘the_content‘. This filter hook can be used by plugins to modify, add to or remove text that makes up a blog post. It is one of the most common filter hooks used by plugins. A plugin might, for example, add a user-defined piece of text to the end of each blog post. Because Simple:Press Forum displays on a standard WordPress page, it also uses this filter hook to display all pages of the forum. If the other plugin is written well and knows when to apply it’s code then the forum will be unaffected. If, on the other hand, the plugin is written badly, then the forum will also show this piece of text at the bottom. This is a very simple and harmless example. Bad use of other hooks can have a profound effect on your site and be quite hard to track down.

Finding Your Errors

Before asking us for support it would be helpful if you could perform some preliminary tests to see if there is indeed a script conflict. If the thought of installing and using Firebug scares you, then there is much you can do with the Firefox Error Console. Try these simple steps using Firefox:

  1. Open the Error Console from the Firefox ‘Tools’ menu and click on the ‘Clear’ button.
  2. Load the forum page/view you need and attempt the operation that is failing or causing the problem
  3. Look at the ‘Errors’ tab of the console. (Ignore the Warnings tab). You may well see a list of errors which we will need if we are to help you.
  4. Next – from the Firefox ‘View’ menu, click on ‘Page Source’. Please note this may not work if the problem is in a popup window.
  5. With the page source open – click on search and enter a search term of .js (dot-js). This will highlight all of the Javascript files loaded.
  6. Go to each one and make a note of it’s name. You are firstly looking for any duplicate script files that may be loaded. Remember that a script library like ‘jQuery’ may be called jquery.js or something like jquery-min.js. Sometimes a version number may also be appended. Note that down as well.
  7. Make another pass of all the .js files to see where they are loaded from. In most circumstances (ads and some special scripts are an exception), they should ALL be loaded from your own domain. If any are not then note those down as well.

This information can be invaluable in finding and locating script conflicts. And if you find a script that matches an entry in the error console – try to determine which plugin loaded it and deactivate that plugin to see if the conflict is resolved. But remember as well – many themes also load script files and many do not load them correctly.


Article written by steve on January 23, 2010 and last modified by Yellow Swordfish on June 11, 2010