[wp-hackers] wp-config.php, wp-load.php, and ABSPATH
otto at ottodestruct.com
Wed Sep 16 19:27:09 UTC 2009
On Wed, Sep 16, 2009 at 1:46 PM, Stephen Rider
<wp-hackers at striderweb.com> wrote:
> enqueues it as "xyz". Plugin B includes the same library and also enqueues
> it as "xyz". Okay, through the magic of code there is no duplication. But
> what happens if Plugin A has an older version of the library? If that gets
> loaded then Plugin B is stuck with the older version. Is there a way to
> avoid that? A way to ensure the newer version loads?
The version parameter isn't there to avoid conflicts, it's there for
cache-busting. It's added to the script name in the output, as a get
parameter, so that if the version changes, browsers are sure to get
the new version.
The code can't cope with multiple versions in that way. It's only
looking at the handle. The one that got enqueued first would probably
be the one output.
> (Frankly, it would be cool if there were a way to enqueue a PHP library as
If the library is smart enough, it will not allow itself to be loaded
twice (using function_exists or class_exists), so simple includes
would work fine with it.
If the library is not smart enough, you can wrap the include inside a
function_exists or class_exists yourself, to detect when it's already
loaded and to not load it again.
Sent from Memphis, TN, United States
More information about the wp-hackers