Skip to content
PHP Logo

Are there any specific server configurations or settings that can impact the display of TinyMCE content when echoed in PHP?

The display of TinyMCE content echoed in PHP can be impacted by the server's PHP configuration settings, particularly the `magic_quotes_gpc` setting. If this setting is enabled, it can add backslashes to certain characters in the content, affecting its display. To solve this issue, you can disable `magic_quotes_gpc` in your PHP configuration or use the `stripslashes()` function to remove the added backslashes before echoing the TinyMCE content.

php
// Disable magic_quotes_gpc setting
if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value) {
        $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
        return $value;
    }
    
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}