[conditional] shortcode displays as plain text, not processed
-
Dear Jules Colle & Conditional Fields for Contact Form 7 Team,
I am experiencing an issue where the
[conditional] shortcodes (e.g.,
[conditional your-field equals "value"]) are not being processed by your plugin. Instead, they are displayed as plain text on the front-end of my website. As a result, the conditional logic is not working at all.2. Issue Description:
The
[conditional ...]and[/conditional]tags are rendered as plain text within the form on the live page. The content intended to be shown/hidden by these tags is always visible, and no conditional logic is applied.
3. Troubleshooting Steps Taken (Problem persists after each of these steps):
- Switched to a default WordPress theme (e.g., Twenty Twenty-Four).
- Deactivated all other plugins. The issue persists even when only “Contact Form 7” and “Conditional Fields for Contact Form 7” are active. (My custom plugin “Check-in Drive Uploader” was also deactivated during this minimal configuration test).
- Deactivated the “Contact Form 7 – Repeatable Fields” plugin and tested with a very simple form using only
[conditional]tags (no[field_group]tags, see test form code below). The issue still occurs. - Browser Developer Console (Console Tab): No fatal JavaScript errors that seem directly related to
conditional-fields-for-contact-form-7are observed. The console shows a JQMIGRATE message and a warning from my customcheck-in-ux.js(due to missing elements in the simplified test form, which is likely unrelated to this core issue, and this custom script was not active during the absolute minimal plugin test). SomeUnchecked runtime.lastErrormessages also appear, which seem to be browser-extension related. - Browser Developer Console (Network Tab): Your plugin’s JavaScript file (
scripts.js?ver=2.5.11) is confirmed to be loaded correctly (Status 200 OK). - WordPress Debug Log (
debug.log): After deactivating other potentially “noisy” plugins (like Hostinger AI Assistant and Polylang), no PHP errors (Fatal errors, Warnings, etc.) related toconditional-fields-for-contact-form-7are logged when viewing the form page. - Important Observation from
debug.log(when other plugins were previously active): I did observe the following PHP Deprecated notice related to Contact Form 7: (Please use the “Code” button in the forum editor for this log snippet)
PHP Deprecated: WPCF7_ContactForm object's id property is no longer accessible. Use id() method instead. in /path/to/wp-includes/functions.php on line XXXX- (Line number might vary). Could this deprecated way of accessing the form ID (if used by your plugin) be a factor in why Conditional Fields might not be functioning correctly with CF7 v6.0.6 and PHP 8.2.27?
4. Simple Test Form Code (The problem reproduces with this exact code):
<p>Please select your nationality.<span class="required">*</span><br />
[select* your-nationality include_blank "Japan" "USA" "China" "Other"]</p>
<p>Your Name<span class="required">*</span><br />
[text* your-name]</p>
[conditional your-nationality not_equal "Japan"]
<fieldset style="margin-top:15px; border:1px solid #ccc; padding:10px;">
<legend>Passport Information (for non-Japanese nationals)</legend>
<p>Passport Number<br />
[text passport-number]</p>
<p>Expiry Date<br />
[date passport-expiry]</p>
</fieldset>
[/conditional]
<p>[submit "Test Submit"]</p>5. Expected Behavior:
The
[conditional]shortcodes should be processed (i.e., not visible as text). The “Passport Information” fieldset should only appear when a nationality other than “Japan” (or the initial blank “—” option frominclude_blank) is selected from theyour-nationalitydropdown.tags are displayed as plain text on the page. The “Passport Information” fieldset is always visible, regardless of the selection in the dropdown.
I would be very grateful for any insights, suggestions, or guidance you can provide to help resolve this issue. Please let me know if you require any further information from my end.
For security and privacy reasons, I would prefer not to share the direct URL to my live site at this stage. However, I have tried to provide as much detail as possible about the environment and the troubleshooting steps I’ve taken. I can also provide screenshots or a short video of the issue if that would be helpful.
Thank you for your time and for developing this plugin.
Best regards,
Yuma.
The topic ‘[conditional] shortcode displays as plain text, not processed’ is closed to new replies.