视觉作曲家将双引号("some text")转换为反引号(``some text``)

Visual composer Converting Double quote ("some text") into back quote ( ``some text`` )

如何将带有双引号的 visual composer 短代码转义为文本字段中的双引号 每次在字符串中我添加双引号,VC 将其转换为反引号 ex。 Lorem ipsum dolor sit amet, "consectetur" 变成 Lorem ipsum dolor sit amet,``consectetur``

下面是我为自定义 header 创建的代码,其中包含自定义标题、自定义文本、背景图像和右侧图像。

我几乎使用了所有数据 Sanitization/Escaping 方法和正则表达式,但运气不好

class vcCustomHeader extends WPBakeryShortCode {

    // Element Init
    function __construct() {
        add_action( 'init', array( $this, 'vc_customheader_mapping' ) );
        add_shortcode( 'vc_customheader', array( $this, 'vc_customheader_html' ) );
    }

    // Element Mapping
    public function vc_customheader_mapping() {

        // Stop all if VC is not enabled
        if ( !defined( 'WPB_VC_VERSION' ) ) {
            return;
        }

        // Map the block with vc_map()
        vc_map(
            array(
                'name' => __('VC Custom Header', 'text-domain'),
                'base' => 'vc_customheader',
                'description' => __('VC Custom Header addon', 'text-domain'),
                'category' => __('Stevetrautman theme', 'text-domain'),
                'icon' => get_template_directory_uri().'/assets/images/demo.png',
                'params' => array(

                    array(
                        "type" => "textfield",
                        "holder" => "h3",
                        "class" => "title-class",
                        "heading" => __( "Title", "text-domain" ),
                        "param_name" => "title",
                        "value" => __( "", "text-domain" ),
                        "description" => __( "Add Header Title", "text-domain" ),
                        "admin_label" => false,
                        "weight" => 0,
                        "group" => "Text",
                    ),

                    array(
                        "type" => "textarea",
                        "holder" => "div",
                        "class" => "text-class",
                        "heading" => __( "Text", "text-domain" ),
                        "param_name" => "text",
                        "value" => __( "", "text-domain" ),
                        "description" => __( "Add Header Text", "text-domain" ),
                        "admin_label" => false,
                        "weight" => 0,
                        "group" => "Text",
                    ),

                    array(
                        "type" => "attach_image",
                        "holder" => "img",
                        "class" => "head-bg-img",
                        "heading" => __( "BackGround Image", "text-domain" ),
                        "param_name" => "imagebg",
                        "value" => __( "", "text-domain" ),
                        "description" => __( "Add Header Background Image", "text-domain" ),
                        "admin_label" => false,
                        "weight" => 0,
                        "group" => "Image",
                    ),
                    array(
                        "type" => "attach_image",
                        "holder" => "img",
                        "class" => "head-right-img",
                        "heading" => __( "Header Right Image", "text-domain" ),
                        "param_name" => "imageright",
                        "value" => __( "", "text-domain" ),
                        "description" => __( "Add Header Right Image", "text-domain" ),
                        "admin_label" => false,
                        "weight" => 0,
                        "group" => "Image",
                    )
                )
            )
        );

    }


    // Element HTML
    public function vc_customheader_html( $atts ) {
        $html='';
        // Params extraction
        extract(
            shortcode_atts(
                array(
                    'title'     => '',
                    'text'      => '',
                    'imagebg'   => '',
                    'imageright'=> '',
                ),
                $atts
            )
        );

        // Fill $html var with data
        $imageBG = wp_get_attachment_image_src($imagebg, 'full');
        $headerRight = wp_get_attachment_image_src($imageright, 'full');
$html = '
        <div class="lp-hero-main full-section" style="background-color: #f4f4f4; background-image: url('.$imageBG[0].'); background-position: bottom right; background-repeat: no-repeat; background-size: 37% auto; padding: 134px 0 47px;">
    <div class="inner-hero-lp full-section">
        <div class="lp-left">
            <h1>' . $title . '</h1>
            <p>' . $text . '</p>
        </div>';
        if($headerRight){
            $html.='
                <div class="lp-right text-center">
                    <img src="'.$headerRight[0].'">
                </div>';
        }
        $html.='</div>
    </div>';
        return $html;

    }

} // End Element Class


// Element Class Init
new vcCustomHeader();

尝试了 <h1>' . str_replace('``', '"', $title) . '</h1> 并且有效,我知道这不是正确的方法但解决了我的问题