Settings page: boolean-type values display correctly in Bricks, not in front-end

Support MB Settings Page Settings page: boolean-type values display correctly in Bricks, not in front-endResolved

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #49982
    ShemzoneShemzone
    Participant

    **Environment**
    - WordPress 7.0 (happened as well with 6.9.4)
    - Bricks Builder 2.3.5
    - Meta Box 5.12.0
    - Meta Box AIO 3.7.1 (includes MB Settings Page)

    **Description**
    I've been tearing my hair out for the past few days
    I have a Settings Page (slug: reglages-generaux-site) with a radio field (sub_header_display_radio) with two options: show and hide.

    The value is correctly stored in the database as a serialized string — confirmed via direct SQL query:
    `
    SELECT option_value FROM wp_options WHERE option_name = 'reglages-generaux-site'
    → "sub_header_display_radio";s:8:"show" (or "hide" depending of the settings)
    `

    **The problem**

    get_option( 'reglages-generaux-site' ) and rwmb_meta() both return the correct value ("show" or "hide") inside the **Bricks Builder editor**, but on the **front-end** (logged out or logged in as a non-admin), both consistently return string(1) "1" regardless of the actual saved value.

    This issue only affects boolean-type fields (switch, checkbox, radio). All other field types on the same settings page return correct values on the front-end.

    **Steps to reproduce**
    1. Create a Settings Page with a radio field (two options)
    2. Save a value from the settings page admin UI
    3. Read the value with get_option() or rwmb_meta() on the front-end
    4. The returned value is "1" instead of the actual option key

    **Expected behavior**
    get_option() and rwmb_meta() should return the saved option key ("show" or "hide") consistently in all contexts.

    **Actual behavior**
    - In Bricks editor: returns correct value ("show" / "hide")
    - On front-end: always returns "1"

    **Additional note**
    A direct SQL query bypassing all WordPress filters confirms the correct value is in the database. This suggests a WordPress filter (option_reglages-generaux-site or similar) may be transforming the value specifically in the front-end context, but I have not been able to identify its origin.

    #49986
    PeterPeter
    Moderator

    Hello Shemzone,

    Thanks for reaching out.

    If you use a default WordPress theme and add the code to output the field value get_option( 'reglages-generaux-site' ) or rwmb_meta(), does it show the correct value show/hide in the frontend?

    If so, I believe the issue comes from the Bricks theme. Let me know how it goes.

    #49988
    ShemzoneShemzone
    Participant

    Hi @Peter and thank you for looking into my problem

    I tried with Twenty Twenty Five Theme: same issue.

    Example from Front end with Twenty Twenty Five
    Example from Front end  with Twenty Twenty Five

    Example from Front end with Bricks
    Example from Bricks builder

    Example from Bricks builder
    Example from Bricks builder

    Example from Bricks builder with other custom fields values from the same settings page
    Example from Bricks builder with other custom fields values from the same settings page

    I add the json file if it can be helpful
    Custom fields form Settings page (json)

    Note: I have translated from French the expected values (Show -> Afficher and Hide -> Masquer) as requested in the ticket, but the problem remains the same.

    #49989
    ShemzoneShemzone
    Participant

    @Peter
    Correction of the second screen capture (wrong file)

    #49990
    PeterPeter
    Moderator

    Hello,

    I import your field group to my demo site, use the code below to output the radio field value but don't see any issue

    $value = rwmb_meta( 'sub_header_display_radio', ['object_type' => 'setting'], 'custom_settings' );
    echo $value;
    
    echo '<br>';
    
    $value2 = rwmb_meta( 'statut', ['object_type' => 'setting'], 'custom_settings' );
    echo $value2;
    

    screenshot https://imgur.com/XgJZHeq

    Can you please copy your site to a staging site and share the admin account with me by submitting this form?
    https://metabox.io/contact/

    I will take a look.

    #49991
    ShemzoneShemzone
    Participant

    Hi Peter, I sent a message via the contact form.
    Thank you!

    #50003
    PeterPeter
    Moderator

    The issue happens because the settings field values are translated with "1" value using Polylang. Removing the translation value will fix the issue.

    Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.