Why is not scripts or embed code displaying in Listdom listing description?
Questi contenuti non sono ancora disponibili nella tua lingua.
If you’ve added a JavaScript or embed code (for example, a booking widget or iframe) into the Listing Description field in Listdom, you may notice that it doesn’t display on the front end. Even when switching to code mode inside the editor, the script disappears after saving or doesn’t execute at all when viewing the listing.
This is expected behavior, and it’s related to how WordPress handles security and content sanitization.
Why It Happens
Section titled “Why It Happens”The Listing Description field in Listdom uses the native WordPress editor, which automatically filters out potentially unsafe code for security reasons.
This includes <script>, <iframe>, <embed>, and other tags that can execute JavaScript.
This protection prevents malicious code from being injected into your directory listings. As a result, when you add any JavaScript directly to the description, it is stripped out before rendering.
How to Verify
Section titled “How to Verify”To confirm whether the issue is specific to Listdom or your WordPress setup:
- Create a new WordPress post or page.
- Switch to code view and paste the same embed script.
- Publish the post and check if the script executes.
If it still doesn’t appear, the behavior is consistent across all post types, meaning WordPress itself is blocking the script for safety.
Recommended Solutions
Section titled “Recommended Solutions”Depending on what you’re trying to embed (for example, a Sample Booking Widget or another third-party script), there are safe methods to add it without editing plugin files.
Option 1: Use a Shortcode (Recommended)
Section titled “Option 1: Use a Shortcode (Recommended)”If your script is related to a plugin or third-party service that provides a shortcode, use that instead of embedding the raw script. Shortcodes are safe and fully supported within the Listing Description field.
Example:
[sample_widget]You can register your own shortcode through your theme or a custom plugin using PHP.
Option 2: Add via a Widget or Page Builder
Section titled “Option 2: Add via a Widget or Page Builder”If you’re using Elementor, Divi, or another builder, you can insert the embed code using their HTML widget on the single listing template.
This method keeps your JavaScript isolated and ensures it renders properly on the front end.
Summary
Section titled “Summary”To keep your directory secure, WordPress prevents execution of JavaScript in post editors. Listdom inherits this behavior for the listing description field to avoid XSS vulnerabilities. Always use shortcodes, or widget areas for embedding third-party scripts safely.