1

There is a class for plugins and themes that makes custom meta boxes easier to develop called cmb_Meta_Box from Custom-Metaboxes-and-Fields-for-WordPress at https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress and they update that class and code.

I'm trying to make sure that if I use the latest version of this class/script in a plugin that if a user has an older version of it, it fails gracefully. So, for example, 1.1.0 has some new features, but if someone already has loaded 0.9.0 from another plugin that loaded before my plugin, what can I do? There is now a constant so I'm thinking I could warn the user on my admin pages, but if they're not technical they wouldn't know what to do with that warning.

I hope this makes sense and some folks have ideas what I can do within WordPress to solve this possible issue.

Thanks!

1

Short version — there isn't one. WordPress doesn't handle dependencies logic in any form. If library itself doesn't include any mechanism for it (which is exceedingly rare) — there isn't anything you can do.

At best you can (and should) check if expected version of dependency is loaded (if it exposes version in some form or at least by location it's loaded from).

In private sites this can be handled (via Composer for example), but there is no good solution for publicly distributed code.

1
  • Thanks, guess it's either rename the 3rd party class/functions and/or throw up a warning on the admin screens since the newer versions do expose the version of the library. Appreciate the feedback! – Andrew T Apr 21 '14 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.