Support Forum
Support › Meta Box Conditional Logic › Conditional Logic Not Working on FrontendResolved
The conditional logic of my form is not working in the frontend. Works fine in the post type page but shows all fields on frontend
Hi,
Please try to deactivate all plugins except Meta Box, MB extensions and switch to the default theme of WordPress (Twenty TwentyOne) then re-check the issue.
Get more details on the step Debugging Information https://support.metabox.io/topic/how-to-create-a-new-topic/
Let me know how it goes.
I am using Twenty TwentyOne Theme and only have oxygen enabled with Metabox, Is oxygen causing the issue?
Getting this error - uncaught referenceerror wp is not defined
So I figured it out, when I remove the post_fields from the shortcode the conditional logic stops working, how do I remove title and content and keep conditional logic?
I've tried replacing with date, revisions and others but still doesnt work.
Hi,
Can you please share the code that creates the custom fields, conditional logic, and the frontend shortcode? I will check it on my local site.
Hi Long,
I have the exact same issue. Working with Metabox AIO and Oxygen. With post_fields included in the shortcode, conditional logic works fine but as soon as I remove it (or remove "content" and leave "title") it just stops working, displaying the field all the time.
Here's the shortcode used in Oxygen:
[mb_frontend_form id="command-form"]
Here's the code for the conditional logic:
https://pastebin.com/TfabQPQu
And the full code for the custom fields:
https://pastebin.com/eAGrSQBh
Thanks!
Hi Jordan,
Please try to use the shortcode in the Block editor or Classic editor. Let me know how it goes.
Same problem persists without Oxygen.
Hi Jordan,
I do not see any issue with your code, screen record https://share.getcloudapp.com/2NuweR4z.
Please make sure that Meta Box and Meta Box extensions are up to date. Then follow the step Debugging Information here https://support.metabox.io/topic/how-to-create-a-new-topic/.
Let me know if it helped.
Everything is up to date. If I deactivate Oxygen completely is does work, so there must be a conflict somewhere.
I'll contact Oxygen team to see if they can provide help. In the meantime, would there be a way to make it work (for example, keeping post_fields="title, content" in the shortcode but disabling it via CSS display: none)? -- I've tried this but couldn't get it working.
The issue has been resolved by Oxygen team. The problem was caused by Oxygen's built-in optimisation "Disable WP Emojis", which needs to be unchecked in Oxygen --> settings --> Bloat Eliminator. Conditional Logic now works fine!
Thanks for letting me know. I will mark this topic as Resolved.