I am trying to save a base64 encoded html to the Wordpress table and then get that field, decode it and display the content, but somehow all the quotes are "escaped" so that the HTML after being decoded looks like this :posts_meta
<div class=\"row\">
<div class=\"col-md-4 col-xs-4 col-sm-4 column\">
</div>
How can I solve it or what alternatives are there to the base64_encode function?
To solve that you could eliminate the \ through the function
str_replace()
for example;Or you could also use the function
stripslashes()
for example:To check how they work, you can print the html as text using
htmlspecialchars()
In both cases it will print you:
<div class="col-md-4 col-xs-4 col-sm-4 column">
I always try to prioritize native Wordpress methods or functions to avoid problems in the long run.
In the end I solved it using the function: