We’re happy to announce that the minor version of Meta Box is released today. This is an important release as it has a lot of improvements. We worked hard on the code to optimize and refactor it. Let’s see what’s new in Meta Box 4.8.0.

New loading mechanism

The Meta Box plugin is used much in WordPress themes and plugins. Although it’s recommended to use the plugin as a standalone plugin, some developers want to include the plugin directly into their products. In the previous versions, that caused some issues if a standalone plugin is already installed or if it’s already included in another plugin.

The 4.8.0 introduces new loading mechanism that solves this problem. Now developers can include the Meta Box inside their themes/plugins simply by copying the plugin folder to the theme/plugin and include the main plugin file. It’s smart enough to detect the installed version and prefer the standalone plugin if it’s installed.

The new loading mechanism also uses PHP autoloading feature, which:

  • Prevents loading files twice
  • Loads files only when necessary

Thus, it saves memory and increases the performance of your website.

If you’re using Composer, this also works as well.

Code is heavily optimized and refactored

We’ve been working a lot with code quality tools like SensioLabsInsight and CodeClimate to improve the quality of the plugin. Following the instructions, we have removed a lot of redundant code and improve the security of the plugin. Of course there are still a lot of things to do, but most of them relate to the way we code WordPress plugin and is not easy to change in the near future.

If you’re a WordPress developer, you should definitely check these tools. They help a lot making a better application.

Other improvements

  • 3 fields user, post, taxonomy now shares the same code base as they’re native WordPress objects and use similar options. We have optimized the code of these fields (we call it object choice field) and standardize the syntax of them to make them the same. Don’t worry, old syntax still works. (Check the documentation for more info).
  • Add srcset in the returned value of helper function for image fields
  • Better sanitize value for url field
  • Prevent issues with dashes in field types
  • Remove redundant value in checkbox
  • Update CSS for date, time fields
  • Select2 now updated to 4.0.1
  • Optimize code for file_advanced and image_advanced fields which now submit array of values when saving instead of single CSV value
  • Add collapse option to checkbox_list and checkbox_tree in user, taxonomy, post fields which prevents plugin save parent values.
  • Secure password field so it is no longer saved in plain text. To check if a password matches the hash, please use wp_check_password.
  • Change the output of color field in the helper function. Now it shows the color instead of hex value.
  • Add color:change and color:clear JavaScript event for detecting changes in color field.

Bug fixes

  • Rewrite the JavaScript for cloning which causes bugs for date field.
  • Fix missing attributes if value is ‘0’ or 0.
  • Add missing `class` attribute for fields
  • Do not auto populate color field with ‘#’
  • Wrong callback for fix page template

If you find any bugs with this version, please open a new issue on Github.

 

Leave a Reply