• Resolved chcw

    (@chcw)


    Hi,

    I create a small translator with your plugin. However, whenever I input a text with HTML tags, your plugin will always process it.

    For example, I input the following text:

    Translate the following contents to German, do NOT change the HTML tags: "<strong>DataNumen Access Repair</strong> is the <strong>best</strong> MS Access repair and recovery tool in the world. It can repair the corrupt Access .mdb and .accdb databases and recover as much of your data as possible, thereby minimizing the loss in file corruption."

    Then get the following result:

    How to prevent this and keep the HTML tags in both the input and the output?

    • This topic was modified 1 year, 6 months ago by chcw.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Val Meow

    (@valwa)

    Hey @chcw ! ??

    To escape HTML in AI Engine chatbot window, you can use the htmlspecialchars() function in PHP. This function converts special characters to their HTML entities, preventing them from being interpreted as HTML code. ??

    add_filter( 'mwai_ai_reply', 'my_reply', 10, 2 );
    
    function my_reply( $reply, $query ) {
    
    
        $reply->result = htmlspecialchars( $reply->result );
    
        return $reply;
    }

    Thread Starter chcw

    (@chcw)

    @valwa

    Thank you. Where should I add these codes?

    Plugin Support Val Meow

    (@valwa)

    Hey @chcw !

    You should add this code in your theme’s functions.php file or use a third-party plugin to inject filters into your theme ??

    Thread Starter chcw

    (@chcw)

    OK. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Keep the HTML tags in output texts’ is closed to new replies.