CKEditor - Parse content through PHP htmlspecialchars

by
Jeremy Canfield |
Updated: March 11 2020
| CKEditor articles
CKEditor will change the opening bracket character < to the markup < and closing bracket character > to >. For example, if <input type="text"> is placed inside of a CKEditor code snippet, <input type="text"> will br produced. This will cause problems with CKEditor and the web page.
As an example, let's say you are using PHP to retrieve data from a column named content in a SQL database.
<?php
$content = $row["content"];
?>
The PHP htmlspecialchars function can be used to fix the problem where CKEditor changes certain special characters to HTML.
<?php
$content = htmlspecialchars($row["content"], ENT_QUOTES);
?>
Did you find this article helpful?
If so, consider buying me a coffee over at