Hi,
I’m writing to report a critical bug found in Winden v3.1.3 when used
alongside Bricks Builder and Gutenberg. The issue prevents custom fields
(meta boxes) from being saved for any Custom Post Type when Winden is active.
The bug has been identified, analyzed, and resolved locally with a minimal
patch. Below you’ll find all technical details for reproduction and the
suggested fix.
I hope this can be helpful.
Kind regards,
Gerardo
Plugin: Winden v3.1.3
File: includes/Core/BuildersIntegration.php
Method: getBricksThemeFontFamilies()
Severity: High — custom fields of any CPT are never saved when Winden is active
ENVIRONMENT
– WordPress 6.9.4 — PHP 8.3 — Bricks Builder 2.3.1 — JetEngine 3.8.7
– Custom post type with JetEngine custom fields (classic meta boxes)
SYMPTOM
When Winden is active, custom fields (meta boxes) of any CPT are not saved
in the Gutenberg editor (Block Editor). Only the title and content are saved.
Deactivating Winden restores correct saving behavior.
ROOT CAUSE
The method getBricksThemeFontFamilies() in BuildersIntegration.php runs a
WP_Query on bricks_fonts post type and uses $fonts_query->the_post() in the
loop. This overwrites the global $post with the last font found (in our case
post ID 46, “Raleway”).
The chain of the problem is as follows:
1. admin_enqueue_scripts → Admin::enqueue() → BuildersIntegration::bricks()
→ getBricksThemeFontFamilies() → the_post() CHANGES global $post to ID 46
(a bricks_fonts post)
2. wp_reset_postdata() is called but does NOT correctly restore $post in the
admin context, because the main query is not the post being edited
3. In wp-admin/edit-form-blocks.php, require ‘admin-header.php’ (line ~376)
executes step 1
4. Immediately after (line ~383), the_block_editor_meta_boxes() reads
global $post → which is now ID 46 instead of the actual post being edited
5. The form generated for the meta-box-loader contains post_ID=46 (the Bricks
font) instead of the correct post ID
6. Gutenberg sends the meta-box-loader POST to post.php with post_ID=46,
WordPress responds with 400 Bad Request, and custom fields are NEVER saved
PROPOSED FIX
In BuildersIntegration.php, method getBricksThemeFontFamilies(), replace the
loop using the_post() with direct iteration over $fonts_query->posts:
BEFORE (problematic code):
if ($fonts_query->have_posts()) {
while ($fonts_query->have_posts()) {
$fonts_query->the_post();
$font_families[] = get_the_title();
}
wp_reset_postdata();
}
AFTER (fix):
if ($fonts_query->have_posts()) {
foreach ($fonts_query->posts as $font_post) {
$font_families[] = $font_post->post_title;
}
}
This completely avoids touching the global $post. Neither the_post() nor
wp_reset_postdata() are needed since only the font title is required.
ADDITIONAL NOTES
– This bug affects ANY plugin that uses classic meta boxes (not just
JetEngine): ACF, CMB2, Pods, Carbon Fields, etc.
– The bug only manifests in the Block Editor (Gutenberg), not in the classic
editor (which uses a traditional POST form submission)
– wp_reset_postdata() restores $post from the WordPress main query, which in
the admin_enqueue_scripts context does not correspond to the post being
edited — so it is not a valid fix even if called correctly
================================================================================