Reputation: 43
I need to add some html to shortcode image tag for example
<img src="http://image.com/design/images/5Stars.png" alt="5 star rating">
When I check value in database, I can see all double quotation marks formatted with backslashes
<img src=\"http://image.com/design/Images/5Stars.png\" alt=\"5 star rating\">
I have tried to use “htmlspecialchars()” and “esc_attr()” but when I using shortcode I can see simple text instead of html.
Upvotes: 1
Views: 571
Reputation: 501
Try with ob_start
like this example:
function my_shortcode() {
ob_start();
?> <HTML> <here> ... <?php
return ob_get_clean(); }
Upvotes: 0