• This plugin potentially breaks forms that use multi-level name attributes (i.e. the Review submission form in the Site Reviews plugin).

    For example:

    <form>
        <textarea name="site-reviews[content]"></textarea>
    </form>

    This can be fixed by disabling the content shortcode in the Custom Content Shortcode settings, however this is a less than ideal solution.

    A better solution would be to skip detected ccs shortcodes if they appear in a name attribute.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thats wordpress – any shortcode can break your code when using a name attribute with the same name as a shortcode.

    Thread Starter Gemini Labs

    (@geminilabs)

    It’s not WordPress. It’s specific to this plugin as the form is generated through a shortcode.

    • This reply was modified 3 years, 7 months ago by Gemini Labs.

    Ah, ok and if another plugin uses the shortcode-name [content] it would not happen?

    • This reply was modified 3 years, 7 months ago by polarracing.
    Thread Starter Gemini Labs

    (@geminilabs)

    The problem is due to CCS processing shortcodes after the shortcodes/blocks on the page have already been rendered.

    More specifically:

    – Fresh install of WordPress
    – Using the TwentyTwentyOne theme
    – Only Site Reviews and Custom Content Shortcode plugins enabled

    1. ? Using the [site_reviews_form] shortcode by itself works fine.
    2. ? Using the Review Form Gutenberg block does not work (conflict with CCS).
    3. ? If I install the Beaver Builder plugin and use the [site_reviews_form] shortcode in the builder, the conflict happens with CCS.

    If I comment out the following lines in CCS (or disable the plugin), there is no problem.

    Why you don’t just deactivate the content shortcode?

    • This reply was modified 3 years, 7 months ago by polarracing.
    Thread Starter Gemini Labs

    (@geminilabs)

    Why you don’t just deactivate the content shortcode?

    I am the author of the Site Reviews plugin, I recently had to help a user whose website broke due to this issue.

    I submitted the topic here so you could be aware of the problem and hopefully find a solution.

    Thread Starter Gemini Labs

    (@geminilabs)

    Please run a diff against this modified local-shortcodes.php file.

    I have modified it to prevent shortcode collisions with shortcode-like name attributes:

    https://gist.github.com/pryley/9d41d44738cb0d79390bff4eae999147

    While this does fix the problem, I feel like it is essentially a band-aid solution. I suspect that the real cause may be something to do with the order in which hooks are being run.

    For example, while the provided modifications fix the invalid shortcode detection, when the [raw] shortcode setting is enabled, CCS still runs the rendered Site Reviews Form Gutenberg block through wpautop.

    For example, this is the Site Reviews Gutenberg Form Block with the “[raw] shortcode” setting disabled:

    And this is the Site Reviews Gutenberg Form Block with the “[raw] shortcode” setting enabled:

    • This reply was modified 3 years, 7 months ago by Gemini Labs.
    Thread Starter Gemini Labs

    (@geminilabs)

    This is the code responsible for running the wpautop function on the rendered block when the “[raw] shortcode” setting is enabled:

    Thread Starter Gemini Labs

    (@geminilabs)

    For now, I have added this to the Site Reviews help page:

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Conflict with name attributes in form field’ is closed to new replies.