Remove sanitize from render_template

Support MB Blocks Remove sanitize from render_templateResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #24226
    Content PilotContent Pilot
    Participant

    Hi,

    I built a Gutenberg block and as part of the template I have a form. There seems to be some sanitize function that is stripping that HTML tag in render_template.

    I tried with the sanitize_callback parameter with no luck. Is there any way I can remove the sanitization or modified the ruleset you are using?

    I checked this but I can't see the MB Block code.

    Thanks

    #24239
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Thank you for your reporting!

    Can you please share full the code to create the block, template, and steps to happen the issue? I will try to reproduce the issue on my end. Some screenshots are very appreciated.

    #24249
    Content PilotContent Pilot
    Participant

    Sure,

    You can take the extension example code, even without fields. Just add a <form></form> in the template file.

    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        $meta_boxes[] = [
            'title'           => 'Hero Content',
            'id'              => 'hero-content',
            'description'     => 'A custom hero content block',
            'type'            => 'block',
            'icon'            => 'awards',
            'category'        => 'layout',
            'context'         => 'side',
            'render_template' => get_template_directory() . '/blocks/hero/template.php',
        ];
        return $meta_boxes;
    } );

    template.php

    echo '<div><form><button>Label</button></form></div>';

    Using render_callback doesn't make a difference.

    #24253
    Content PilotContent Pilot
    Participant

    Long, you can close this ticket. Another badly closed form tag was deleting the form that is rendered inside the block without further clues. Thanks

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