We have made several improvements for Meta Box and extensions since the last month. There are some hotfixes for Meta Box and major improvements for extensions. Please see below for details.

Meta Box Updates November 2018
Meta Box Updates November 2018

New Meta Box versions

Meta Box 4.15.7 was released 3 days ago with some fix for taxonomy and taxonomy_advanced field from saving and showing data. This is a hotfix update and we suggest you update the plugin immediately.

Previously in Meta Box 4.15.6, which were released on October 26th, there are several fixes for the plugin, such as:

  • Fixed selecting files in Microsoft Edge for file_upload and similar fields.
  • Fixed returning value for cloneable single_image field.
  • Fixed zoom level is not working for map on the front end.
  • Fixed missing missing gettext function and comment for Dashboard page.
  • Fixed OSM map not refreshing in tabs or after moving meta boxes.

We also restored the missing choice_label filter for choice fields. See this documentation for how to use the filter. It’s very useful when you need to change the label appeared in the list of posts or users.

In addition, we added a helper function rwmb_get_object_fields() to get list of fields for an object. See documentation for how to use it.

MB Revision and MB Custom Table

After many trials, we got these 2 extensions working together. Now you can track changes of custom fields in custom table with revisions. There’s nothing required from your side. All the work are done automatically behind the scene. And you can just preview your changes in the WordPress revision screen.

Integration with Beaver Builder just got better

The integration with Beaver Builder now supports getting values from your settings page. It also supports getting term meta as well. So if you want to create a settings page for clients to enter something like contact information, social links without letting them edit the layout in Beaver Builder, then we got you covered.

With the term meta support, you can show more things in the category page, custom post type archive page, etc. It’s very helpful when you customize your layouts with Beaver Themer.

Meta Box Template might be your next must-have tool

We’ve just revamped the Meta Box Template extension which now supports parsing configurations from a list of files or directories. That means you can create .yaml files to store configurations for your meta boxes, put them in a folder and tell the plugin the path to that folder. The whole thing of parsing the meta boxes and registering your meta boxes will be done automatically by the plugin.

This feature is similar to Local JSON in ACF, but here you use YAML syntax instead of JSON. And it have some benefits over than traditional PHP code or using Builder

  • Writing configuration in YAML is readable. So in the future, if you want to change some settings, you’ll have to edit it easily and fast.
  • YAML is very powerful and supports all type of configurations. So whatever you can do with PHP, you can do with YAML.
  • You can store your configs in multiple files or directories.
  • You can add your files or directories with filters (programmatically). It’s useful when you don’t want to use the plugin’s UI to set the paths. But you want to have them fixed in code.

We’re going to write a dedicated tutorial for this and will add a video soon. So stay tuned!

Meta Box Conditional Logic is 10x faster

We were working on improving the speed of conditional logic checks in the last few weeks. When you use the Meta Box Conditional Logic to build your content sections (see video below), then you might have tens of conditions between a hundred fields. And showing or hiding fields based on other fields’ values is a heavy-load task.

When it comes with cloneable groups, the task is more harder. Because you have to deal with unlimited clones and/or unlimited nesting levels.

So, we spent weeks on improving the JavaScript code, removing a lot of redundant check or loop, use native JavaScript as much as possible. And finally we made the speed increased about 10 times in our test. With a complex nested group, the conditional check is around 100-200ms.

See the video below to watch the result. Previously, after cloning about 3-4 times, it takes about 1.5s to make a new clone. But now we can clone up to 20 times with the delay < 300ms.

Some lessons learnt from the optimization:

  • Use native JavaScript as much as possible. If needed, use UnderscoreJS instead of jQuery. jQuery should be the last choice.
  • Cache as much as possible, especially jQuery selector. In Conditional Logic, we use a modified version of Selector Caching.
  • Don’t find elements from the top of your document. Instead, try to scope them and use $scope.find( selector ). It’s much faster than running just $( selector ) especially when your page have a lot of clones.
  • Simplify the logic.

In addition to the speed improvement, we also made required fields no longer prevent from submitting when they’re hidden. E.g., when a field is hidden, its required attribute takes no effect and users still can submit posts.

Other fixes

MB User Profile

  • Removed password fields in edit profile forms (by default). (7 days ago) <Anh Tran>
  • Added Portuguese (Brazil) translation

Meta Box Builder

  • Fix options for choice fields in nested groups
  • Added missing file_upload and image_upload field types
  • Fixed warning for PHP < 5.4

If you find any bug, please let us know!


Also published on Medium.

Leave a Reply