Forum Replies Created
-
AuthorPosts
-
October 28, 2026 at 10:51 PM in reply to: Edit screen freezes with many relationship connections (show() + n² options) #50255
Adrien
ParticipantHi Peter,
Thanks for confirming so quickly. Here are the two patches we run on our site. Both are temporary and will be removed once your fix ships. They are plain PHP, so they can go in a small plugin or a theme's functions.php.
1) JS: no forced style recalc during mb_ready
<?php /** * Temporary site-side patch: Meta Box start-up (mb_ready) without a forced style recalc per field. * Only while the document-level "mb_ready" runs, show() on select_advanced dropdowns and on the * clone add/remove buttons just clears an inline display:none (these elements are visible by * default in Meta Box's CSS). Every other show() call keeps jQuery's behaviour, and show() is * restored right after "mb_ready". */ add_action( 'admin_enqueue_scripts', function () { if ( ! wp_script_is( 'rwmb', 'enqueued' ) ) { return; } $js = <<<'JS' ( function ( $, rwmb ) { 'use strict'; if ( ! $ || ! rwmb || ! rwmb.$document ) { return; } const selector = 'select.rwmb-select_advanced, select.rwmb-icon, .rwmb-button.remove-clone, .rwmb-button.add-clone'; const $document = rwmb.$document; const originalTrigger = $document.trigger; $document.trigger = function ( event ) { const name = typeof event === 'string' ? event : ( event && event.type ); if ( name !== 'mb_ready' ) { return originalTrigger.apply( this, arguments ); } const originalShow = $.fn.show; $.fn.show = function () { const onlyFastTargets = arguments.length === 0 && this.length > 0 && Array.prototype.every.call( this, el => el.nodeType === 1 && el.matches( selector ) ); if ( ! onlyFastTargets ) { return originalShow.apply( this, arguments ); } for ( const el of this ) { if ( el.style.display === 'none' ) { el.style.display = ''; } } return this; }; try { return originalTrigger.apply( this, arguments ); } finally { $.fn.show = originalShow; } }; } )( window.jQuery, window.rwmb ); JS; wp_add_inline_script( 'rwmb', $js, 'after' ); }, PHP_INT_MAX );We kept it narrow on purpose. Other show() calls during mb_ready (tabs, file and media fields) still go through jQuery, because we didn't check whether their elements are hidden by CSS. In your code, the direct fix is still the one from my first post, in transform() and in the clone.js toggles.
2) PHP: each clone only renders its own option(s)
<?php /** * Temporary site-side patch: each row of a cloneable ajax object field only renders its own option(s). * RWMB_Clone::html() runs the "rwmb_html" filter on each clone with ( $html, $sub_field, $sub_meta ). */ add_filter( 'rwmb_html', function ( $html, $field, $meta ) { if ( ! is_admin() || ! is_string( $html ) || empty( $field['clone'] ) || empty( $field['ajax'] ) ) { return $html; } if ( ! in_array( $field['type'] ?? '', [ 'post', 'taxonomy', 'taxonomy_advanced', 'user' ], true ) || 'select_advanced' !== ( $field['field_type'] ?? '' ) ) { return $html; } // The row's value: one ID, an array of IDs (multiple) or a comma list (taxonomy_advanced). $ids = []; if ( is_array( $meta ) ) { array_walk_recursive( $meta, function ( $value ) use ( &$ids ) { if ( is_scalar( $value ) ) { $ids[] = $value; } } ); } elseif ( is_scalar( $meta ) && '' !== (string) $meta ) { $ids = (string) $meta; } $keep = array_flip( array_filter( wp_parse_id_list( $ids ) ) ); // RWMB_Walker_Select writes <option value="ID" ...>escaped label</option>; the placeholder (value="") stays. $new = preg_replace_callback( '#<option value="(\d+)"[^>]*>.*?</option>#s', function ( $match ) use ( $keep ) { return isset( $keep[ (int) $match[1] ] ) ? $match[0] : ''; }, $html ); return null === $new ? $html : $new; }, 99, 3 );This one works on the HTML because there is no per-clone filter on the options themselves. In your code, filtering $field['options'] per clone is cleaner. One detail: the one-liner in my first post uses (array) $meta, which doesn't split taxonomy_advanced comma lists. The patch above handles those, as well as multiple fields.
Results on our post: mb_ready went from 54 s to 3.9 s with patch 1 alone, and to 752 ms with both. Saving keeps every connection; we checked the counts in wp_mb_relationships before and after.
Happy to test the build on a staging copy as soon as it's ready.
Thanks!
Adrien — Stellar Web Solutions
November 18, 2025 at 12:14 AM in reply to: Unable to save due to email field is set to required #49363Adrien
ParticipantHello Peter,
It's a simple Field group, here the JSON content:
{
"$schema": "https://schemas.metabox.io/field-group.json",
"custom_settings": {
"tab_style": {
"id": "tab_style",
"key": "tab_style",
"value": "default"
},
"tab_default_active": {
"id": "tab_default_active",
"key": "tab_default_active",
"value": ""
},
"tab_remember": {
"id": "tab_remember",
"key": "tab_remember",
"value": false
}
},
"fields": [
{
"name": "Ville | Intro",
"id": "ville__intro",
"type": "group",
"fields": [
{
"name": "Pre Heading",
"id": "pre_heading",
"type": "text",
"columns": 4,
"limit_type": "character"
},
{
"name": "Heading",
"id": "heading",
"type": "text",
"columns": 4,
"limit_type": "character"
},
{
"name": "Description",
"id": "description",
"type": "wysiwyg",
"columns": 4,
"limit_type": "character"
}
],
"tab": "stats"
},
{
"name": "Ville | Stats Grid Choice",
"id": "ville__stats_grid_choice",
"type": "radio",
"options": {
"3": "3 Stats Card",
"4": "4 Stats Card"
},
"inline": false,
"tab": "stats"
},
{
"name": "Ville | Big Landscape Image",
"id": "ville__stats_big_landscape_image",
"type": "single_image",
"columns": 4,
"tab": "stats"
},
{
"name": "Ville | Stats Small Image 1",
"id": "ville__stats_small_image_1",
"type": "single_image",
"columns": 4,
"visible": [
"ville__stats_grid_choice",
4
],
"tab": "stats"
},
{
"name": "Ville | Stats Small Image 2",
"id": "ville__stats_small_image_2",
"type": "single_image",
"columns": 4,
"visible": [
"ville__stats_grid_choice",
4
],
"tab": "stats"
},
{
"name": "Ville | Stats Card 1",
"id": "ville__stats_card_1",
"type": "group",
"fields": [
{
"name": "Icon",
"id": "icon",
"type": "single_image",
"columns": 3
},
{
"name": "Label",
"id": "label",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Value Titre",
"id": "value_titre",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Description",
"id": "description",
"type": "text",
"columns": 3,
"limit_type": "character"
}
],
"tab": "stats"
},
{
"name": "Ville | Stats Card 2",
"id": "ville__stats_card_2",
"type": "group",
"fields": [
{
"name": "Icon",
"id": "icon",
"type": "single_image",
"columns": 3
},
{
"name": "Label",
"id": "label",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Value Titre",
"id": "value_titre",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Description",
"id": "description",
"type": "text",
"columns": 3,
"limit_type": "character"
}
],
"tab": "stats"
},
{
"name": "Ville | Stats Card 3",
"id": "ville__stats_card_3",
"type": "group",
"fields": [
{
"name": "Icon",
"id": "icon",
"type": "single_image",
"columns": 3
},
{
"name": "Label",
"id": "label",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Value Titre",
"id": "value_titre",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Description",
"id": "description",
"type": "text",
"columns": 3,
"limit_type": "character"
}
],
"tab": "stats"
},
{
"name": "Ville | Stats Card 4",
"id": "ville__stats_card_4",
"type": "group",
"fields": [
{
"name": "Icon",
"id": "icon",
"type": "single_image",
"columns": 3
},
{
"name": "Label",
"id": "label",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Value Titre",
"id": "value_titre",
"type": "text",
"columns": 3,
"limit_type": "character"
},
{
"name": "Description",
"id": "description",
"type": "text",
"columns": 3,
"limit_type": "character"
}
],
"visible": [
"ville__stats_grid_choice",
4
],
"tab": "stats"
},
{
"name": "Ville | About - Heading",
"id": "ville__about_heading",
"type": "text",
"limit_type": "character",
"tab": "about_ville_tab"
},
{
"name": "Ville | About - Description",
"id": "ville__about_description",
"type": "textarea",
"limit_type": "character",
"tab": "about_ville_tab"
}
],
"id": "cpt-ville",
"modified": 1762093758,
"post_types": [
"ville"
],
"tabs": {
"stats": {
"label": "Stats",
"icon": "dashicons-chart-bar"
},
"about_ville_tab": {
"label": "About",
"icon": "dashicons-media-default"
}
},
"title": "[CPT] - Ville"
}November 18, 2025 at 12:10 AM in reply to: ✅"Something went wrong. Please try again!" when opening Custom Field Group #49362Adrien
ParticipantI have the same issue
November 16, 2025 at 12:56 AM in reply to: Unable to save due to email field is set to required #49345Adrien
ParticipantAre you guys testing your plugin on multiple type of website before updating it?
Just tried v3.3.2 which should supposedly fixed the required fields in Field Group, and now I cannot load those page I have these errors in console.log:
November 10, 2025 at 10:34 PM in reply to: Unable to save due to email field is set to required #49310Adrien
ParticipantHello Peter,
No it's not, and I have Meta Box AIO 3.3.1: https://markuphero.com/share/FrogME1X9oP2LRdxKqQ6
I clear all site / cache data and I cannot update the Field Group if I have required fields: https://markuphero.com/share/YIdF16VCJfbZushKc9qC
November 10, 2025 at 9:49 PM in reply to: Unable to save due to email field is set to required #49307Adrien
ParticipantAny update on this? It's painful having to write text in all required fields before saving...
Thanks Peter
November 10, 2025 at 8:59 PM in reply to: MB hook / filter to alter the results of the Location search (for WPML) #49306Adrien
ParticipantHello Peter,
It would be super useful as of right now it's a pain to know which post is it (when using WPML)
Adrien
ParticipantI would like to know once it's available, very desirable feature, I could have used that already multiple time...
October 15, 2025 at 7:16 PM in reply to: Unable to save due to email field is set to required #49156Adrien
ParticipantI have the same issue, and I just updated to Meta Box AIO 3.2.0 as well, I cannot save my Field group because of required text in the right when editing a Meta Box Field group
Adrien
ParticipantAny news on this?
June 24, 2025 at 10:36 PM in reply to: Show Meta Box Field Group on the user creation page (user-new.php) #48505Adrien
ParticipantHello Peter,
Alright I hope it will come quickly after the v5.0
Thanks.
April 26, 2024 at 11:32 PM in reply to: ✅How to translate MB fields within a MB setting page (with WPML)? #45324Adrien
ParticipantThanks you Peter, would love to see that full compatibility soon! 🙏
April 24, 2024 at 10:25 PM in reply to: ✅How to translate MB fields within a MB setting page (with WPML)? #45298Adrien
ParticipantHello Peter,
Thank you for the guidance on translating custom fields in the settings page using the wpml-config.xml. However, considering our frequent updates and the dynamic nature of fields in our settings pages, manually editing the wpml-config.xml file every time we introduce a new field would be quite cumbersome and prone to errors. This approach doesn't seem scalable or efficient in a fast-paced development environment.
Is this something that Meta Box is currently working on to improve, or is there a more dynamic way to handle translations for these custom fields, perhaps through an API or a hook provided by WPML or Meta Box, that can dynamically register these fields for translation as they are created or modified?
Thanks for your support and looking forward to your suggestions on a more streamlined approach.
Adrien
ParticipantAny new regarding this? When we have lot and lot of MB custom fields we can't rely on the fact that we need to add them each time inside the wpml-config.xml, it should be automatic or at least having the ability to translate MB fields inside a MB setting page.
Adrien
ParticipantAny news regarding this?
-
AuthorPosts